What is the basic difference between the Factory and Abstract Factory Design Patterns?

user366312 picture user366312 · Jun 16, 2009 · Viewed 228.4k times · Source

What is the basic difference between the Factory and Abstract Factory Patterns?

Answer

John Feminella picture John Feminella · Jun 16, 2009

With the Factory pattern, you produce instances of implementations (Apple, Banana, Cherry, etc.) of a particular interface -- say, IFruit.

With the Abstract Factory pattern, you provide a way for anyone to provide their own factory. This allows your warehouse to be either an IFruitFactory or an IJuiceFactory, without requiring your warehouse to know anything about fruits or juices.