Re: Difference between Factory and Abstract Factory



On 25 Mar, 17:47, EvilOld...@xxxxxxxxxxxxxx wrote:
I've read the gang of four, and various things I've googled, but I'm
just too stupid to really get the difference between a factory and an
abstract factory.
Help me please...

There is no, "Factory." That's a generic term (at least in the context
of GOF).

There are two patterns: abstract factory and factory method.

If anything, the generic term, "Factory," means something that will
return an implementation that accords to a given interface. The
abstract factory and factory method are just two different ways to
return this implementation.

..ed

--

www.EdmundKirwan.com - Home of The Fractal Class Composition

.



Relevant Pages

  • 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. ... Cat * MakeTheKittah{ ... An Abstract Factory as far as I can see is simply a factory method ...
    (comp.object)
  • 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)
  • Re: Difference between Factory and Abstract Factory
    ... This is my take on the Abstract Factory. ... I was too lazy to create a concrete factory for every day of the week, ... public string GetDescription() ... class SaturdayMenu: IMenu ...
    (comp.object)