Abstract Factory


This is a pattern that allows you to create families of related objects without specifying the concrete classes.

First, interfaces must be declared for each distinct product. We can make variants of products according to these interfaces.

We then declare an abstract factory, which is a class with methods for creating each product (e.g. createChair, createSofa...) returning the type represented by the interfaces written previously.

For each product variant, a factory is created according to the interface defined before. A factory only creates products of the same family, for example ModernChair, ModernSofa...

Applications

Issues

META

Status:: #wiki/notes/mature
Plantations:: Creational Patterns - 20230221095426
References:: Dive Into Design Patterns