An AbstractFactory is a class that exists to create instances of another class. Described on page 87 of the DesignPatternsBook.
Typically, if you want to construct instances of a class, where the class is selected at run time, you...
Suppose an abstract class wants to hide its sub class name and its instantiation. If we request one static method of the class that return its sub class object.
abstract class AA
{
static AA getInstance()
{
return new A();
}
}
class A extends AA
{
}
class Client
{
AA aa=AA.getInstance();
aa.method();
}
See also: FactoryMethod, DesignPatterns, AbstractFactoryVsFactoryMethod
External refs: http://ruby-practices.stevej.name/wiki/show/AbstractFactoryViaModuleNew
http://wiki.cs.uiuc.edu/patternStories/AbstractFactoryPattern
An extension is the PluggableFactory proposed by JohnVlissides.
Independently, AbstractFactory combines very well with PluginArchitecture to create an extensible AbstractConstructor. (Described in AbstractFactory page.)