Single Responsibility Principle (SRP)
- cohesion - things that change together, should stay together
Open-Closed Principle (OCP)
- open for extension but closed for modification
- if existing code is now wrong, replace with correct code
- inheritance - bad practice
Liskov Substitution Principle (LSP)
- subclass can be accepted for a class
- use small interfaces over inheritance
Interface Segregation Principle (ISP)
- use small interfaces so you only depend on what you need
Dependency Inversion Principle (DIP)
-
depend on abstractions
-
details should depend on abstractions
-
testability
-
Encapsulation
-
Loose coupling