SOLID Principles in C#
In object-oriented programming, SOLID is an acronym for the five design principles introduced by Robert C. Martin. These principles are used to design software applications maintainable and testable.
SOLID are principles, not patterns. Learn what's the difference between pattern and principle.
SOLID stands for:
- S = Single Responsibility Principle
- O = Open/Closed Principle
- L = Liskov Substitution Principle
- I = Interface Segregation Principle
- D = Dependency Inversion Principle
Single Responsibility Principle
Each software module should have one and only one reason to change.
Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.
Liskov Substitution Principle
Subtypes must be substitutable for their base type.
Interface Segregation Principle
Clients should not be forced to depend on methods they do not use.
Dependency Inversion Principle
High-level modules should not depend on low-level modules. Both should depend on abstraction
Learn about each principle in the next.