S.O.L.I.D. is a collection of best-practice, object-oriented design principles which can be applied to your design, allowing you to accomplish various desirable goals such as loose-coupling, higher maintainability, intuitive location of interesting code, etc.
S.O.L.I.D. is an acronym for:
– SRP: Single Responsibility Principle
– OCP: Open Closed Principle
– LSP: Liskov Substitution Principle
– ISP: Interface Segregation Principle
– DIP: Dependency Inversion Principle
SRP: Single Responsibility Principle
There should never be more than one reason for a class to change.
OCP: Open Closed Principle
Software entities (Classes, Modules, Functions, etc.) should be open for extension but closed for modification.
LSP: Liskov Substitution Principle
Functions that use … references to base classes must be able to use objects of derived classes without knowing it.
ISP: Interface Segregation Principle
Clients should not be forced to depend upon interfaces that they do not use
DIP: Dependency Inversion Principle
1. High level modules should not depend upon low level modules. Both should depend upon abstraction
2. Abstraction should not depend upon details. Details should depend upon abstraction.
We will discuss each principle in depth using C# example in upcoming post. Stay tune!