Re: abstract factory -- a doubt ?
Daniel T. wrote:
"Prevent" is a pretty strong word in my book. I don't think Abstract
Factory does prevent violations of OCP. For example say I have a set of
related types that the factory is supposed to create, and I want to add
another type to that set... I've got to open every sub-class of the
Abstract Factory (as well as the Abstract Factory itself)...
m not too sure that i understand .. esp the part which says "open ..
the Abstract Factory itself" .. could you explain with an example ?
.
Relevant Pages
- Re: Downcasting - whats the problem?
... type identifier and based on that identifier chooses a factory object. ... The OCP protects us from rigid systems, systems which are hard to extend. ... associated factories without having to touch the generic algorithm at all. ... (comp.object) - Re: Downcasting - whats the problem?
... > type identifier and based on that identifier chooses a factory object. ... I would design the code to be as easy as possible to be used by any ... >> relevance of OCP ... RCM's downcast without based on a heuristic that takes no account of ... (comp.object) - Re: using jMock with components
... >> chance to mock it. ... Whilst running normally the factory class returns ... > but don't worry about Abstract factory it is a valid approach. ... >> I created a factory interface which exposed the components I needed to ... (comp.lang.java.programmer) - Re: Difference between Factory and Abstract Factory
... abstract factory. ... these are like Abstract Factory and ... Factory Method respectively. ... Override methods like createThing() *in the factory*. ... (comp.object) - Re: using jMock with components
... Whilst running normally the factory class returns ... Usually its fine to have the createXXXComponent method on the abstract factory itself, which internally just delegates to the concrete factory. ... The reason I created the two factories is so I can omit the mock factory when I make a distribution. ... with the interface and merge the abstract and real factory classes together and create a getComponentmethod which creates a newInstance of the class using reflection, and have the test factory override that method. ... (comp.lang.java.programmer) |
|