SOLID is an acronym of five object oriented design principles by Robert C. Martin. These principles are essential guidelines for making code maintainable, scalable, loose coupling, flexible and stable.
- Single Responsibility Principle (SRP)
- Open-Closed Principle (OCP)
- Liskov Substitution Principle (LSP)
- Interface Segregation Principle (ISP)
- Dependency Inversion Principle (DIP)
-
Single Responsibility Principle (SRP)
- a. Bad Design (Violation of SRP)
- b. Good Design (Following SRP)
-
Open-Closed Principle (OCP)
- a. Bad Design (Violation of OCP)
- b. Good Design (Following OCP)
-
Liskov Substitution Principle (LSP)
- a. Bad Design (Violation of LSP)
- b. Good Design (Following LSP)
-
Interface Segregation Principle (ISP)
- a. Bad Design (Violation of ISP)
- b. Good Design (Following ISP)
-
Dependency Inversion Principle (DIP)
- a. Bad Design (Violation of DIP)
- b. Good Design (Following DIP)
- Dependency Injection
- Loose Coupling
- High Cohesion
- Match Expression
- Method Injection
- Constructor Property Promotion
- Named Parameters
- Type Hinting
- Constructor Injection
- Nullable Type
- Constructor Properties
- Flexible & Stable
