Talk:Factory Method

From CSSEMediaWiki
Revision as of 02:45, 20 October 2010 by Benjamin Gibson (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Notes: At first it seems odd that the Gang of Four design patterns book suggest that Creator may also define a default implementation of the factory method that returns a default ConcreteProduct object. Because the diagram in the book shows that Creator is an abstract class. But this suggestion does make sense because the Creator class doesn't necessarily have to be abstract.


Just a Comment to that Notes above which was original on the page itself: I think it makes sense to have the Creator as an abstract class since in an abstract class you can have methods which are implemented. So if the factoryMethod() in the Creator has default implementation which returns a default ConcreteProduct that doesn't contradict with the idea of an abstract class. So I think the Creator class is always going to be abstract.--Dom 02:05, 6 October 2008 (UTC)

Noted that this pattern violates the Dependency inversion principle in Consequences section --Benjamin Gibson

Personal tools