Sobes.tech
Senior

What creational patterns do you know?

sobes.tech AI

Answer from AI

Creational design patterns are responsible for creating objects and managing their instantiation process. The main creational patterns are:

  • Singleton — ensures that 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 allows subclasses to 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 — creates new objects by copying an existing prototype.

These patterns help make the code more flexible and easier to extend.