When developing an OO design you should strive to be SOLID.
- Single Responsibility
- Open/Closed
- Liskov Substitution
- Interface Segregation
- Dependency Inversion
Liskov substitution : if class A is a subtype of class B, we should be able to replace B with A without disrupting the behavior of our program.
Interface segregation : larger interfaces should be split into smaller ones. By doing so, we can ensure that implementing classes only need to be concerned about the methods that are of interest to them.
Dependency Inversion: The principle of dependency inversion refers to the decoupling of software modules. This way, instead of high-level modules depending on low-level modules, both will depend on abstractions.
No comments:
Post a Comment