Creational patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.

When to use them

  • When the creation process is complex: If creating an object is a multi-step process or requires logic, it's best encapsulated.
  • When you need to decouple the system from specific classes: This helps in making the system more modular and flexible.
  • When you want to abstract the instantiation process: Hide the logic of creating objects and just present a ready-to-use object.

Fundamental creational patterns

Singleton

Ensure a class has only one instance and provide a global point to access it.

The rest of the content (4 read minutes) is restricted.

Please use your personal access token or register to access.

Create account or login