Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customize to solve a recurring design problem in your code. This repository includes various design patterns, organized by their categories, with corresponding class diagrams and code examples.
Pattern | Class Diagram | Code |
---|---|---|
Factory | Factory Code | |
Singleton | Singleton Code | |
Builder | Builder Code | |
Prototype | Prototype Class Diagram | Prototype Code |
Abstract Factory | Abstract Factory Code |
Pattern | Class Diagram | Code |
---|---|---|
Chain of Responsibility | Chain of Responsibility Code | |
Command | Command Class Diagram | Command Code |
Iterator | Iterator Code | |
Mediator | Mediator Code | |
Observer | Observer Class Diagram | Observer Code |
Visitor | Visitor Code | |
Template Method | Template Method Code | |
Memento | Memento Class Diagram | Memento Code |
State | State Class Diagram | State Code |
Strategy | Strategy Code |
- This repository includes design patterns from the creational, structural, and behavioral categories.
- Each pattern folder contains:
- A README file explaining the design pattern.
- A class diagram for a visual representation.
- Code examples demonstrating how to implement the pattern.
- You may find code examples from different websites.
Problem Name | Link |
---|---|
Document Manager | Document Manager |
Cab Booking Service | Cab Booking Service |
Splitwise | Splitwise |
Key-Value Store | Key Value Store |
ATM System | ATM System |
Magical Arena | Magical Arena |
Vending Machine | Vending Machine |
- Refactoring.Guru: A comprehensive resource for understanding design patterns with examples.
- Head First Design Patterns: A book that provides an engaging and easy-to-understand approach to learning design patterns.