🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.oodesign
3 messages
3 total messages Started by Simon Guertin Tue, 11 Jul 2006 17:51
Should I use a Factory Design pattern ?
#70
Author: Simon Guertin
Date: Tue, 11 Jul 2006 17:51
27 lines
2114 bytes
Good afternoon, I need some advice about using a factory device pattern.
I will first tell you what I want to do!

I my application I want to be able to apply different License Key 
managers according to the currently active license key type.

I would love to represent a License Key in its own object. The license 
key type would be determined by the String representation of the license 
key. (For now the last letter of the license key would determine the 
type). I was trying to do some good data abstraction by having the super 
class license key and then some classes that iniherits from this super 
class to have the more specific class that implements the right license 
key type. For example a Trial key would be simple but other kind of keys 
would have some information contained withing the string to 
enable/disable features in the software.  Would it be the factory to 
first find out wich type of key it is from the string than instanciate 
the right subclass?

I never used the factory design pattern and I would like to know if this
is an appropriate situation to use it and how should I design my License 
key classes and subclasses?

any input is welcome,

Thank you

Simon
Re: Should I use a Factory Design pattern ?
#71
Author: Mark Guerrieri
Date: Tue, 18 Jul 2006 02:56
12 lines
1594 bytes
> I never used the factory design pattern and I would like to know if this
> is an appropriate situation to use it and how should I design my License 
> key classes and subclasses?

Sounds to me more like a straight forward OOP design would suffice. 
Abstract license key base class defines virtual methods for all fetaures, or 
even just a couple of virtual methods such as EnableFeatures, 
DisableFeatures, GetAvailableFeatures, etc.  Create dervied classes that 
override the appropriate functions, and pass that into a generic method that 
will call the appropriate functions via polymorphism.

Mark 
Re: Should I use a Factory Design pattern ?
#72
Author: Simon Guertin
Date: Wed, 13 Sep 2006 21:17
20 lines
1715 bytes
Mark Guerrieri wrote:
>>I never used the factory design pattern and I would like to know if this
>>is an appropriate situation to use it and how should I design my License 
>>key classes and subclasses?
> 
> 
> Sounds to me more like a straight forward OOP design would suffice. 
> Abstract license key base class defines virtual methods for all fetaures, or 
> even just a couple of virtual methods such as EnableFeatures, 
> DisableFeatures, GetAvailableFeatures, etc.  Create dervied classes that 
> override the appropriate functions, and pass that into a generic method that 
> will call the appropriate functions via polymorphism.
> 
> Mark 
> 
> 

Thanks!

Simon
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads