Design Patterns - Overview Mapping
The following overview categorizes design patterns into several groups, each addressing specific aspects of software design. Note, This list is not exhaustive.
Creational patterns - These patterns focus on object creation mechanisms to increase flexibility and reuse of existing code. ..more
- Abstract Factory: Creates families of related objects without specifying their concrete classes.
- Builder: Separates the construction of a complex object from its representation.
- Factory Method: Defines an interface for creating an object but lets subclasses decide which class to instantiate.
- Object Pool: Manages a pool of reusable objects to improve performance.
- Prototype: Creates new objects by copying an existing object (prototype).
- Singleton: Ensures a class has only one instance and provides a global point of access.
- Dependency Injection: Provides dependencies to an object rather than having it create them internally
- Lazy Initialization: Delays object creation until it's actually needed
- Multiton: Similar to Singleton but maintains a map of named instances
Structural patterns - These patterns explain how to assemble objects and classes into larger, flexible, and efficient structures. ..more
- Adapter (corrected from "adaptor"): Allows incompatible interfaces to work together by wrapping an object.
- Decorator: Dynamically adds responsibilities to objects in a flexible way.
- Facade: Provides a simplified interface to a complex subsystem.
- Flyweight (corrected from "flyweihgt"): Shares fine-grained objects to reduce memory usage.
- Proxy: Controls access to an object by acting as a placeholder or intermediary.
- Bridge: Separates an interface from its implementation, allowing them to vary independently.
- Composite: Composes objects into tree structures to represent part-whole hierarchies
- Module: Encapsulates related functionality into discrete units
Behavioral patterns - These patterns manage effective communication and the assignment of responsibilities between objects. ..more
- Chain of Responsibility (corrected from "chain of command"): Passes a request along a chain of handlers.
- Command: Encapsulates a request as an object, allowing parameterization and queuing.
- Iterator: Provides a way to access elements of a collection sequentially without exposing its structure.
- Mediator: Defines an object that encapsulates how a set of objects interact, reducing direct dependencies.
- Observer: Allows objects to be notified of changes in another object’s state.
- State: Allows an object to alter its behavior when its internal state changes.
- Strategy: Encapsulates an algorithm inside a class
- Template method: Defer the exact steps of an algorithm to a subclass
- Visitor: Defines a new operation to a class without change
- Memento: Captures and restores an object's internal state without violating encapsulation
- Null Object: Provides a default object with neutral behavior to avoid null checks
Data Handling Patterns - These patterns focus on managing data access and persistence.
- Repository: Organizes data access logic around repositories, which encapsulate data retrieval and storage operations, abstracting the persistence layer from the business logic.
- Saga: Manages distributed transactions across microservices by coordinating a series of local transactions with compensating actions.
- Data Mapper: Maps data between objects and a database, keeping them independent to avoid tight coupling.
- Active Record: Combines data access logic and domain logic in a single object, where each instance represents a database row.
- Event Sourcing: Captures all changes to an application state as a sequence of events, allowing reconstruction of the state at any point in time.
Communication Patterns - These patterns focus on how systems or components exchange information.
- Publisher-Subscriber (a variation of Observer): Allows components to communicate indirectly through a message broker, enabling decoupling and scalability.
- Command Query Responsibility Segregation (CQRS): Separates read and write operations into distinct models, optimizing each for specific needs, often used in complex domains.
- Event-Driven Programming: A pattern where system behavior is driven by asynchronous events handled by event listeners or handlers.
- Circuit Breaker: Prevents cascading failures in distributed systems
Concurrency Patterns: - These patterns represent solutions to common problems in concurrent programming, offering structured approaches to managing tasks and synchronizing data access
- Producer-Consumer: Coordinates work between threads that generate and process data
- Thread Pool: Manages a pool of worker threads for task execution
- Actor Model: Encapsulates state and behavior in actors that communicate via messages
Done!
Thanks for reading! We hope this overview helps you understand the various design patterns and their applications in software development. For more detailed explanations, follow the links provided to each specific pattern.