Abstract Factory Pattern

This pattern is one level of abstraction higher than Factory Pattern. The abstract factory returns the factory of classes not the classes themselves unlike the factory pattern.
Abstract Factories are usually implemented using the Factory Method pattern. Another approach would be to use the Prototype pattern.

In Java, an abstract factory can be designed as an abstract class or an interface with its concrete subclasses as factories, where each factory is responsible for creating and providing access to the objects of a particular suite of classes.
Client objects do not have to know about the existence of these concrete factory classes.

This is the abstract form of this pattern:

abstract_factory2.jpg

As an example suppose we have two types of customer, local and remote:

abstract_factory1.jpg
page_revision: 10, last_edited: 1233740413|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License