C# Abstract Factory Pattern - Design Patterns in Action

Abstract Factory Design Pattern

We have already seen about factory method design pattern. abstract factory is about grouping similar family of factory pattern and providing abstract layering for them.

The main motto of abstract factory design pattern is "Provide an interface for creating families of related or dependent objects without specifying their concrete classes." as specified in GoF. Below are the main members of this design pattern:

AbstractFactory - An interface with Get operations for each of the abstract products

Factory1, Factory2 - Implementations of all the AbstractFactory creation operations

AbstractProduct - An interface for a kind of product with its own operations

ProductA1, ProductA2, ProductB1, ProductB2 - Classes that implement the AbstractProduct interface and define product objects to be created by the corresponding factories

Client  - A class that accesses only the AbstractFactory and AbstractProduct interfaces


Posts By Month