Abstract Factory Design Pattern
- In software development, a factory is the location in the code at which objects are constructed.
- The intent in employing the pattern is to insulate the creation of objects from their usage. This allows for new derived types to be introduced with no change to the code that uses the base class.
- The essence of the Abstract Factory method Pattern is to "Provide an interface for creating families of related or dependent objects without specifying their concrete classes".
- For Example:
- Address Factory has no of factories like:
- US Address Factory which implements the Address Interface.
- French Address Factory which implements the Address interface.
- Can have many more country specific factories….
- US Address Factory which implements the Address Interface.
- When we create the French Address using the method implemented in the French Address Factory class it returns the Object reference to the Abstract class of Address.
- The Abstract Address class holds the abstract method named get Country() which is implemented separately by each implementing class