SOLID Principles
A mnemonic acronym for principles of OOP.
S | Single Responsibility |
O | Open/closed |
L | Liskov Substitution |
I | Interface Segregation |
D | Dependency Inversion |
Single Responsibility Principle
A class should have only a single responsibility.
Open/closed Principle (OCP)
Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification..
Liskov Substitution Principle
Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
See also wikipedia: design by contract.
Interface Segregation Principle
Many client-specific interfaces are better than one general-purpose interface.
Dependency Inversion Principle
Depend upon Abstractions, not on concretions.