> Design Patterns > Abstract Factory Design Pattern
Abstract Factory design pattern is used to create families of objects.
The intent is to provide an interface through which families of related or dependent objects can be created. Also while creation, the concrete classes of those objects should not be specified.
Instantiation of objects in application will require hard coding of classes which will make it difficult to manage and modify later. Also the objects are related to a family and will be used together, so the change of family will be cumbersome. There is another problem, when we try to add new family and new product, we may end up creating objects based on multiple scenarios using if, switch as the number of families and their objects grow.
We want to create set of objects to manage the system. The families are Unisys and IBM.
SystemManagementFactory is the abstract class which provides interface for creating set of objects for a family. UnisysSMFactory is the concrete class which implements methods for creating objects of Unisys family. IBMSMFactory is the concrete class which implements methods for creating objects of IBM family. Application uses the ConfigurationManager and OperationManager for a particular family.
|C++||Abstract Factory Pattern in C++||Abstract Factory Pattern C++ Example|
|C#||Abstract Factory Pattern in C#||Abstract Factory Pattern C# Example|
|Java||Abstract Factory Pattern in Java||Abstract Factory Pattern Java Example|
|Python||Abstract Factory Pattern in Python||Abstract Factory Pattern Python Example|
|PHP||Abstract Factory Pattern in PHP||Abstract Factory Pattern PHP Example|
|Ruby||Abstract Factory Pattern in Ruby||Abstract Factory Pattern Ruby Example|
|Swift||Abstract Factory Pattern in Swift||Abstract Factory Pattern Swift Example|
|Objective-C||Abstract Factory Pattern in Objective-C||Abstract Factory Pattern Objective-C Example|