SOLID principles¶
Single responsibility principle¶
A class should have only a single responsibility. A responsibility can be defined as a reason for change. Whenever some part of our code is potentially a responsibility, consider separating it from the class.
Open/closed principle¶
You should be able to extend a classes behavior, without modifying it.
LSP: Liskov substitution principle¶
“objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.” See also design by contract.
ISP: Interface segregation principle¶
“many client-specific interfaces are better than one general-purpose interface.”
DIP: Dependency inversion principle¶
one should “Depend upon Abstractions. Do not depend upon concretions.” Dependency injection is one method of following this principle.
TODO all above