What are the SOLID principles?
They are a set of design guidelines for improving the maintainability and scalability of software.
Origin
The SOLID principles were introduced by Robert C. Martin, also known as Uncle Bob, in his work on object-oriented design in the early 2000s. These principles are a compilation of five design concepts that assist developers in creating software systems.
Definition
SOLID is an acronym that stands for five design principles in object-oriented programming: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion.
Purpose
These principles provide a framework for designing software that is easy to maintain, understand, and expand, allowing developers to avoid common design and architecture pitfalls.
Single Responsibility (SRP)
A class should have only one reason to change.
Open/Closed (OCP)
Software entities should be open for extension, but closed for modification.
Liskov Substitution (LSP)
Objects of a superclass should be replaceable with objects of its subclasses without affecting the functionality.
Interface Segregation (ISP)
Many client-specific interfaces are better than one general-purpose interface.
Dependency Inversion (DIP)
High-level modules should not depend on low-level modules; both should depend on abstractions.