design patterns
Abstract Factory
The Abstract Factory pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes. It is a factory of factories. The key participants are the AbstractFactory (declares creation methods for each type of product), ConcreteFactory (implements creation methods for a specific family), AbstractProduct (declares an interface for a type of product), and ConcreteProduct (implements the AbstractProduct interface). Think of a furniture store with style collections: you can order a 'Modern' set or a 'Victorian' set, and each set includes a matching chair, sofa, and table — all designed to go together. Use Abstract Factory when your system must work with multiple families of related products and you want to ensure compatibility within a family.
Use Cases
- •Cross-platform UI toolkits (Windows, macOS, Linux widgets)
- •Themed component libraries (dark theme, light theme families)
- •Database abstraction layers supporting multiple DB engines
- •Game development with different environment asset sets