What are Creational Patterns?
Creational patterns are focused towards how to instantiate an object or group of related objects.Creational design patterns deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.
Wikipedia Definition
In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.Available Creational Patterns
The following creational patterns are covered in this documentation:Simple Factory
Generate instances without exposing instantiation logic
Factory Method
Delegate instantiation logic to child classes
Abstract Factory
A factory of factories for related object families
Builder
Construct complex objects step by step
Prototype
Create objects through cloning existing ones
Singleton
Ensure only one instance of a class exists
When to Use Creational Patterns?
Use creational patterns when:- Object creation logic is complex
- You need to decouple object creation from usage
- You want to control how objects are created and configured
- You need to manage families of related objects
- You want to avoid tight coupling between classes