Factory Pattern

Definition

There are 2 factory patterns as described by the Gang of Four.

Abstract Factory

The abstract factory pattern is used to provide a client with a set of related or dependent objects. The “family” of objects created by the factory are determined at run-time.

Factory Method

The factory pattern is used to replace class constructors, abstracting the process of object generation so that the type of the object instantiated can be determined at run-time.

References