Welcome to the Design Principles and Design Patterns repository!
This repository is a curated collection of the most essential Object-Oriented Design Principles and Software Design Patterns used by professional developers to write clean, maintainable, and scalable code.
- What Are Design Principles?
- SOLID Principles
- Other Key Principles
- What Are Design Patterns?
- Creational Patterns
- Structural Patterns
- Behavioral Patterns
- Best Practices
- Resources
- License
Design Principles are a set of guidelines that help developers make better design decisions, leading to more robust and flexible software architecture.
A set of five principles introduced by Robert C. Martin to improve Object-Oriented Design:
- S β Single Responsibility Principle (SRP)
- O β Open/Closed Principle (OCP)
- L β Liskov Substitution Principle (LSP)
- I β Interface Segregation Principle (ISP)
- D β Dependency Inversion Principle (DIP)
Each principle is explained with real-world examples and code snippets.
- DRY (Donβt Repeat Yourself)
- KISS (Keep It Simple, Stupid)
- YAGNI (You Arenβt Gonna Need It)
- Law of Demeter
- Composition Over Inheritance
Design Patterns are time-tested solutions to common problems in software design. They provide a shared language and proven practices for solving recurring design problems.
- Singleton
- Factory Method
- Abstract Factory
- Builder
- Prototype
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Flyweight
- Proxy
- Strategy
- Observer
- Command
- Iterator
- Mediator
- Memento
- State
- Visitor
- Template Method
- Chain of Responsibility
- Code examples in Java (or other languages you include)
- UML Diagrams for each pattern
- Real-world use cases
- When to use & when to avoid each pattern