SOLID Principles
A practical walkthrough of the SOLID design principles and how they help create software that is easier to change, extend, test, and maintain.
Create better software by applying SOLID principles
SOLID is an acronym for five design principles that are considered fundamental to object-oriented programming.
Single Responsibility Principle (SRP) - Only one reason to change
The Single Responsibility Principle is the first of the five SOLID principles of object-oriented design, introduced by Robert C. Martin (Uncle Bob).
Open/Closed Principle (OCP) – Building for Extension, Not Modification
The second principle in the SOLID family is the Open/Closed Principle (OCP) . It’s a simple but powerful idea:
Liskov Substitution Principle (LSP) – Subtypes Should Keep Their Promises
The Liskov Substitution Principle is about making abstractions trustworthy: subtypes should preserve the behavioral expectations of their base types.
Interface Segregation Principle (ISP) – Keep Interfaces Focused
The Interface Segregation Principle keeps abstractions focused so clients depend only on the behavior they actually need.
Dependency Inversion Principle (DIP) – Depend on Abstractions, Not Details
The Dependency Inversion Principle keeps high-level policy from being tightly coupled to low-level implementation details.