In computer programming, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Michael Feathers for the “first five principles” identified by Robert C. Martin in the early 2000s that stands for five basic principles of object-oriented programming and design. The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time. The principles of SOLID are guidelines that can be applied while working on software to remove code smells by causing the programmer to refactor the software’s source code until it is both legible and extensible. It is typically used with test-driven development, and is part of an overall strategy of agile and adaptive programming.
S = Single responsibility principle (SRP)
* An object should have only a single responsibility.
O = Open/closed principle (OCP)
* Software entities should be open for extension, but closed for modification
L = Liskov substitution principle (LSP)
* Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program
* See also Design by contract.
I = Interface segregation principle (ISP)
* Many client specific interfaces are better than one general purpose interface.
D = Dependency inversion principle (DIP)
* Depend upon Abstractions. Do not depend upon concretions.
* Dependency injection is one method of following this principle.