Design patterns are classified into several categories based on their primary purpose and the problems they aim to solve. The most common classification of design patterns includes:
Creational Patterns
These patterns deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. They help in making a system independent of how its objects are created, composed, and represented.
Structural Patterns
Structural patterns focus on the composition of classes and objects, making it possible to form larger structures from individual parts. They help in defining relationships between objects, making your system more flexible and efficient.
- Adapter Pattern
- Bridge Pattern
- Composite Pattern
- Decorator Pattern
- Facade Pattern
- Flyweight Pattern
- Proxy Pattern
Behavioral Patterns
These patterns are concerned with the communication between objects, how they operate together, and how they distribute responsibilities. They help in defining how objects interact and communicate with one another.
- Chain of Responsibility Pattern
- Command Pattern
- Interpreter Pattern
- Iterator Pattern
- Mediator Pattern
- Memento Pattern
- Observer Pattern
- State Pattern
- Strategy Pattern
- Template Method Pattern
- Visitor Pattern
Concurrency Patterns
These patterns address multi-threading and concurrent processing issues. They help in managing and synchronizing access to shared resources among multiple threads.
- Active Object Pattern
- Monitor Object Pattern
- Balking Pattern
- Read-Write Lock Pattern
- Thread-Local Storage Pattern
Architectural Patterns
Architectural patterns provide high-level guidelines for designing the overall structure of an application. They define the architecture and organization of a system.
- Model-View-Controller (MVC) Pattern
- Model-View-ViewModel (MVVM) Pattern
- Three-Tier Architecture
- Microservices Architecture
- Service-Oriented Architecture (SOA)
- Event-Driven Architecture (EDA)
Idioms
Idioms are recurring solutions to common programming problems. They are not formal design patterns but are often used to solve specific issues in a particular context.
- Resource Acquisition Is Initialization (RAII)
- Copy-and-Swap Idiom
These categories are not strict, and some patterns may belong to multiple categories. Design patterns provide reusable solutions to common software design problems and help in creating flexible, maintainable, and well-structured code. The choice of which pattern to use depends on the specific problem you are trying to solve and the context of your application.