Design PatternsCreational Patterns
Creational Patterns
Patterns that deal with object creation mechanisms
Creational Patterns
Creational design patterns abstract the instantiation process. They help make a system independent of how its objects are created, composed, and represented.
The Patterns
Factory Method
Define an interface for creating objects, but let subclasses decide which class to instantiate
Abstract Factory
Create families of related objects without specifying their concrete classes
Builder
Construct complex objects step by step, allowing different representations
Prototype
Create new objects by copying existing ones without depending on their classes
Singleton
Ensure a class has only one instance with a global access point
Quick Comparison
| Pattern | Intent | Complexity | Frequency |
|---|---|---|---|
| Factory Method | Defer instantiation to subclasses | ⭐⭐ | Very Common |
| Abstract Factory | Create families of objects | ⭐⭐⭐ | Common |
| Builder | Build complex objects step by step | ⭐⭐ | Common |
| Prototype | Clone objects | ⭐ | Less Common |
| Singleton | Single instance | ⭐ | Very Common |