Middle
What classifications of design patterns do you know?
sobes.tech AI
Answer from AI
There are several classifications of design patterns:
-
By purpose:
- Creational: Manage the process of object creation. Examples: Factory Method, Abstract Factory, Singleton, Prototype, Builder.
- Structural: Define ways to build class and object structures. Examples: Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy.
- Behavioral: Describe interactions between classes and objects. Examples: Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor.
-
By level of abstraction (GoF - "Gang of Four"): This classification, proposed in the book "Design Patterns: Elements of Reusable Object-Oriented Software," is the most common and includes the above categories (creational, structural, behavioral).
-
By application:
- Class design patterns: Describe relationships between classes at compile time.
- Object design patterns: Describe relationships between objects at runtime.
-
By domain specificity:
- User interface patterns: Define ways to interact with the user (e.g., Model-View-Controller, Model-View-ViewModel).
- Interaction patterns: Describe ways components of the system communicate.
- Other domain-specific patterns.