SOLID
Single responsability
This helps a lot when tyring to define how a service, class, object should work. Not defining a single thing that the object is responsable makes it really easy to have overcharged classes that do everything all at once. Making the code completly unmaintainable. And do not confuse responsability with single thing to do or single action. It means the object is only responsable for this specific thing.
Open/Closed
This, to me, means that when modification to add functionality. The best course of action is to add other inheritable classes insted of modifying base class.
Liskov substitution
This means that child and parent should behave as expected. This means that having a base class T and an S class that inherets from T, you cannot somehow change how T behaves, because you need to be able to usse S instead of T.
Interface segregation
Make modular simple interfaces rather than a huge oversized interfaces with all possible methods. Classses shouldnt need to implement methods from interfaces that they dont plan to use.
Dependency inversion
This helps with tightly couple designs. Instead of desining for an OracleDBService class, design for a DBService interface. And make OracleDBService implement the interface.
Comments
Post a Comment