Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Should I use a Factory Design pattern ?

0 views
Skip to first unread message

Simon Guertin

unread,
Jul 11, 2006, 1:51:52 PM7/11/06
to
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

Mark Guerrieri

unread,
Jul 17, 2006, 10:56:40 PM7/17/06
to
> 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


Simon Guertin

unread,
Sep 13, 2006, 5:17:44 PM9/13/06
to

Thanks!

Simon

0 new messages