-
-
Notifications
You must be signed in to change notification settings - Fork 164
SOLID
- S – Single-Responsibility Principle
- O – Open-Closed Principle
- L – Liskov Substitution Principle
- I – Interface Segregation Principle
- D – Dependency Inversion Principle
Single-Responsibility Principle
A class should have only one job and only be responsible for that job. For example, a Logger class for logging should be responsible for Log operations only.
Open-Closed Principle
The objects or entities we write in the application should be closed to open to change. For example, if you say too much to avoid writing if-else it would not be wrong. If you want to expand your method in a way that you have written more in the future, it is necessary to write more extensible codes by using interfaces or abstract classes and when needed.
Liskov Substitution Principle
For the principle of Liskov, we can call it the principle of substitution. When a class is derived from a base class, it can be used instead of the top class.
Interface Segregation Principle
Clients should not be forced to use an interface they do not need or should not implement all interface methods for a single method of the interface they need. The Interface Segregation principle is to separate your interfaces for these situations and say that you do not install more tasks than you need to an interface. Thus, the client does not need to implement any method that he does not need while developing.
Dependency Inversion Principle
Base classes or methods, etc. it should not be dependent on sub-level classes or methods, and a change to subclasses should not affect base classes.
You can check full repository documentations, step by step development and how to build your custom scenario's on this basement in 100+ page eBook PDF from here - http://www.aspnetrun.com.