Explore Topics
Mixing rows is impossible β that's the family-cohesion guarantee.
Abstract Factory is a creational pattern that provides an interface for creating FAMILIES of related products without specifying their concrete classes. Where Factory Method has ONE polymorphic factory method per Creator subclass (one product type), Abstract Factory bundles MULTIPLE factory methods on a single AbstractFactory interface β one per product type in the family. The client picks a ConcreteFactory once at startup; from then on every product the client receives is guaranteed to come from the same family. This is why Abstract Factory is often called the "factory of factories": each concrete factory groups several individual factory methods into a single coordinated bundle, and switching factories swaps the whole bundle atomically.
- A FAMILY of related products is created together, not one product at a time.
- The client depends only on the AbstractFactory interface and abstract Product interfaces.
- Switching ConcreteFactory swaps the ENTIRE family β never a mix of variants.
- Each create*() method on the AbstractFactory is conceptually a Factory Method β Abstract Factory composes several of them.
- "Factory of factories" β one ConcreteFactory packages several Factory Method overrides into one coordinated bundle.
- β¦Guarantees compatible products are used together (no family mismatches)
- β¦Isolates concrete classes β client never names a ConcreteProduct
- β¦Swapping families = swapping ONE factory reference at startup
- β¦Each ConcreteFactory has a single responsibility: produce ONE complete family
- β³Requires inheritance AND composition β heavier than Factory Method
- β³Class explosion: N variants Γ M product types + 2N abstract types
- β³Adding a NEW product type to the family requires editing the AbstractFactory interface AND every ConcreteFactory
- β³Overkill when the product family is fixed or small