The SOLID acronym refers to five object oriented design principles for software developers to adhere to while developing applications, that will lead to a code base that is easier for developers to understand, and applications that are more maintainable and extendable in the future.
The principles that make up the SOLID acronym are known as:
SRP – Single Responsibility Principle.
A class should only have one responsibility and a class should only have one reason to change.
OCP – Open Closed Principle.
Classes should be open for extension and closed for modification. A class should allow its behavior to be extended without the need to modify its source code.
LSP – Liskov Substitution Principle.
Subclasses must be substitutable for their base classes. Given a specific base class, a class that inherits from it can be a substitute for that given base class.
ISP – Interface Segregation Principle.
A class should not be forced to depend on methods that it does not use. Interface segregation splits large interfaces into smaller and more specific ones, so that classes implementing the interface will only have to know about the methods that are relevant to them.
DIP – Dependency Inversion Principle.
Dependency Inversion / Injection decouples objects to the extent that a class does not need to be changed, simply because a class it depends on needs to be changed to a different one.
Over the next few weeks I will endeavour to elaborate further into each principle that forms the SOLID principles of object oriented design while using C#, but in the meantime take a look at the wikipedia entry for more information.
Recent Comments