some design patterns, a factory object has a method for every kind of object it is capable of creating. These methods optionally accept parameters defining how the object is created, and then return the created object. Applications Factory objects are common in toolkits and frameworks where library code needs to create objects of types which may be subclassed by applications using the framework. They are also used in test-driven development to allow classes to be put under test. Factories determine the actual concrete type of object to be created, and it is here that the object is actually created. As the factory only returns an abstract interface to the object, the client code does not know – and is not burdened by – the actual concrete type of the object which was just created. However, the type of a concrete object is known by the abstract factory. In particular, this means: The client code has no knowledge whatsoever of the concrete type, not needing to include any header files or class declarations relating to the concrete type. The client code deals only with the abstract type. Objects of a concrete type are indeed created by the factory, but the client code accesses such objects only through their abstract interface. Adding new concrete types is done by modifying the client code to use a different factory, a modification which is typically one line in one file. This is significantly easier than modifying the client code to instantiate a new type, which would require changing every location in the code where a new object is created. Applicability Factories can be used when: The creation of an object makes reuse impossible without significant duplication of code. The creation of an object requires access to information or resources that should not be contained within the composing class. The lifetime management of the generated objects must be centralized to ensure a consistent behavior within the application. Factories, specifically factory methods, are common in toolkits and frameworks, where library code needs to create objects of types that may be subclassed by applications using the framework. Parallel class hierarchies often require objects from one hierarchy to be able to create appropriate objects from another. Factory methods are used in test-driven development to allow classes to be put under test. If such a class Foo creates another object Dangerous that can't be put under automated unit tests (perhaps