Sobes.tech
Junior — Middle

Can you list the main design patterns used in object-oriented programming?

sobes.tech AI

Answer from AI

The main design patterns in object-oriented programming are divided into three groups:

  1. Creational — responsible for object creation:

    • Singleton
    • Factory Method
    • Abstract Factory
    • Builder
    • Prototype
  2. Structural — define ways to compose classes and objects:

    • Adapter
    • Decorator
    • Facade
    • Composite
    • Proxy
    • Bridge
    • Flyweight
  3. Behavioral — responsible for interactions between objects:

    • Observer
    • Strategy
    • Command
    • Iterator
    • State
    • Template Method
    • Mediator
    • Chain of Responsibility

These patterns help write flexible, extendable, and maintainable code.