Abstract Factory
Intent
Provide an interface for creating families of related or dependent
objects without specifying their concrete classes.
Participants
-
AbstractFactory -
declares an interface for operations that create abstract product
objects.
-
ConcreteFactory -
implements the operations to create concrete product objects.
-
AbstractProduct -
declares an interface for a type of product object.
-
ConcreteProduct -
implements the AbstractProduct interface, defining a product object to
be created by the corresponding concrete factory.
-
Client -
uses only interfaces declared by AbstractFactory and AbstractProduct
classes.
Notes
-
An Abstract Factory can use either Factory Methods or Prototypes.
Examples
In a class library like the Java class libraries it may be hard to
be sure about examples of the AbstractFactory pattern.