This repository contains a Java project demonstrating various design patterns as specified in the "Gang of Four" book and other commonly used design patterns. Each design pattern is implemented as a separate module within the project, and the module name corresponds to the design pattern being demonstrated.
Design patterns are reusable solutions to common problems encountered in software design. They provide a template for solving problems in a particular way, offering a structured approach to design and development. Understanding and implementing design patterns can lead to more efficient, maintainable, and scalable code.
This project aims to provide a practical demonstration of various design patterns in Java. Each design pattern is implemented in a separate module, making it easy to understand and test individual patterns.
The project structure is organized as follows:
creational_patterns/
structural_patterns/
behavioral_patterns/
Each directory contains the implementation of different design patterns, separated into their respective categories.
- π Abstract Factory Pattern
- ποΈ Builder Pattern
- π Factory Method Pattern
- 𧬠Prototype Pattern
- π Singleton Pattern
- π Adapter Pattern
- π Bridge Pattern
- π³ Composite Pattern
- 𧩠Decorator Pattern
- π’ Facade Pattern
- π΅οΈ Proxy Pattern
- π 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
To use this project:
- Clone the repository to your local machine:
git clone https://github.com/yourusername/design-patterns-java.git
- Navigate to the desired design pattern module:
cd design-patterns-java/creational_patterns/builder
- Follow the instructions provided in the
README.md
file within the module to understand the pattern and run the example code:javac *.java java Main
Contributions are welcome! If you'd like to contribute to this project by adding more design patterns, improving existing implementations, or fixing bugs, please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature
- Make your changes.
- Commit your changes:
git commit -am 'Add new feature'
- Push to the branch:
git push origin feature/your-feature
- Create a new Pull Request.
By structuring and documenting design patterns in a comprehensive way, this project aims to serve as a valuable resource for developers looking to deepen their understanding of software design principles and improve their coding practices. Happy coding! π