Abstract Factory pattern
The Abstract Factory is a creational design pattern that lets you create an abstract representation of factories without specifying concrete classes. You can think of this pattern as a factory of factories. You use it to create a common shape of factory objects and then when you want to use them in practice, you implement specific methods to create those objects.
Using this pattern, you retain the flexibility to define multiple concrete implementations for the factories without altering the process of using them. The client code is easier to change and manages a different factory at runtime. Let's describe the reasons to use this pattern in practice.
When do we use the Abstract Factory?
This pattern provides a way to encapsulate the basic building methods for creating families of related objects. Those are the key observations and criteria to understand before applying this pattern:
- Need a factory of related objects: Instead of creating...