Overview
Introduced by Robert C. Martin (Uncle Bob), SOLID is an acronym for five principles that help developers build robust and scalable object-oriented systems.
The Principles
- S - Single Responsibility Principle: A class should have only one reason to change.
- O - Open/Closed Principle: Software entities should be open for extension but closed for modification.
- L - Liskov Substitution Principle: Objects of a superclass should be replaceable with objects of its subclasses without breaking the application.
- I - Interface Segregation Principle: Clients should not be forced to depend on interfaces they do not use.
- D - Dependency Inversion Principle: Depend on abstractions, not concretions.
Benefits
- Reduced code coupling.
- Easier testing and refactoring.
- Improved code reusability.