This repository contains descriptions and code examples for 23 common design patterns. These patterns are divided into three categories: Creational, Structural, and Behavioral.
This repository contains code examples and tests for each of the 23 design patterns. The code examples can be found in the src/main directory, organized by pattern. Each pattern has its own subdirectory containing the relevant code examples.
The tests for each pattern can be found in the src/test directory. These tests demonstrate how the code examples can be used and provide a way to verify their correctness.
We encourage you to explore the code examples and tests to gain a deeper understanding of each pattern and how it can be applied in practice.
Creational patterns are used to create objects in a systematic way, abstracting the process of object creation and allowing for more flexibility in the type of objects that are created. Some common creational patterns include:
- Simple Factory:√
- Factory Method:√
- Abstract Factory:√
- Prototype
- Builder
- Singleton
Structural patterns are used to define the relationships between objects, allowing for more complex structures to be created from simpler components. Some common structural patterns include:
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
Behavioral patterns are used to define the interactions between objects, allowing for more complex behavior to be achieved through the cooperation of multiple objects. Some common behavioral patterns include:
- Chain of Responsibility
- Command
- Interpreter
- Iterator
- Mediator
- Memento
- Observer
- State
- Strategy
- Template Method
- Visitor
Each pattern is described in detail in its own directory, along with code examples demonstrating its use. We hope that this repository will be a valuable resource for anyone looking to learn more about design patterns and their practical applications.