🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.oodesign
Article #70

Should I use a Factory Design pattern ?

#70
From: 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
Technical Details
Message-ID: <44b3e5b9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,68a20bed5a8325,start
X-Google-Attributes: gid10db1e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 11 Jul 2006 13:51:52 -0400
From: Simon Guertin <sguertin_AT@trellianetworks.com>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.oodesign
Subject: Should I use a Factory Design pattern ?
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 70.50.240.227
Message-ID: <44b3e5b9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1152640441 70.50.240.227 (11 Jul 2006 10:54:01 -0700)
Lines: 27
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail