What is the basic difference between the Factory and Abstract Factory Patterns?
19 s
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.