It can be difficult to control the creation of objects that need complex initialization. In addition, sometimes, we need to decide which object in a class should be created at runtime. This can depend on a state or external values that became known just before a certain moment at runtime, for instance, values that are retrieved from a server or a file. The most common patterns that belong to the creational group are listed here:
- Factory method
- Builder
- Abstract factory
- Singleton