Saturday, October 26, 2024

SOLID

 When developing an OO design you should strive to be SOLID.

  1. Single Responsibility
  2. Open/Closed
  3. Liskov Substitution
  4. Interface Segregation
  5. Dependency Inversion
Liskov substitutionif class A is a subtype of class B, we should be able to replace with without disrupting the behavior of our program.
Interface segregationlarger 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