140 reputation
3
bio website
location Sydney, Australia
age
visits member for 1 year, 9 months
seen Sep 26 '13 at 6:21

May
15
accepted Which design pattern would be best for this case?
May
9
comment Which design pattern would be best for this case?
Florian, I would definitely prefer a solution with no code change. However it's a little more complicated than my snippet suggests. A simple implementation of the method might just return a bunch of policies of different types. Year by year, that might just mean defining what types apply to which year. But also, their construction changes - so one year PolicyTypeA applies to the Client, but the next it needs to apply to one of their assets... Other changes might occur which are entirely unexpected. Therefore at this stage it seems creating a new factory each year is the way to go.
May
9
comment Which design pattern would be best for this case?
Thanks everyone for your input - most valuable. Konrad, Im looking into your solution at the moment it sounds like my PolicyProvider class was really a Factory after all. Perhaps if you put an answer down the bottom I can tick it.
May
9
asked Which design pattern would be best for this case?
Oct
15
comment What is the correct pattern to use in this case?
Thanks, Jeff - I have only just now learned of NoSQL. It is very impressive. For other aspects of my application this will be perfect. "Polyglot Persistence" probably, but I will now look into a total NoSQL solution. Cheers.
Oct
13
comment What is the correct pattern to use in this case?
Thanks, Shuvo. Question: in your description for "Map entire class hierarchy to single table" is it a typo to say this is a good strategy where there is "little or no overlap between the types within the hierarchy"? I thought it would've been the opposite?
Oct
13
awarded  Scholar
Oct
13
awarded  Supporter
Oct
13
comment What is the correct pattern to use in this case?
Thanks, soloist - this was very useful. I've marked Shuvo's response the answer due it's detail.
Oct
13
accepted What is the correct pattern to use in this case?
Oct
13
awarded  Student
Oct
13
asked What is the correct pattern to use in this case?