Creational Patterns
Creational design patterns are concerned with the way of creating objects.
They provide various object creation mechanisms, which increase flexibility and reuse of existing code.
They are particularly useful in situations where the system needs to be independent of how its objects are created, composed, and represented.
The most common Creational design patterns are:
- Singleton: Ensures a class has only one instance and provides a global point of access to it.
- Factory Method: Defines an interface for creating an object, but lets subclasses alter the type of objects that will be created.
- Abstract Factory: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.
- Builder: Separates the construction of a complex object from its representation, allowing the same construction process to create different representations.
- Prototype: Specifies the kinds of objects to create using a prototypical instance, and creates new objects by copying this prototype.
These patterns help in managing the complexity of object creation, promoting code reuse, and enhancing the maintainability of the codebase.