Solid Principles - Project example
Single Responsibility Principle
your code should have only one job - Mail and SMS
Open/Closed Principle
We can override the class functionality, but not change the existing class. Abstract -> Overide. Example - Version Maintain
Liskov/Substitution Principle
Derived class must be substitutable for its base class.
Abstract Class -> Interface -> No Override method
Use Abstract class in interface and give more explanation
Interface Segregation Principle
clients should not be forced to implement interfaces they don't use. Instead of one fat interface, many small interfaces are preferred.
Dependency Inversion Principle
high-level modules/classes should not depend on low-level modules/classes. should depend upon abstractions.
Use dependency injection for injecting the dependency
No comments:
Post a Comment
Comments Welcome