Of all the revolutions that have occurred in
our industry, two have been so successful that they have permeated our mentality
to the extent that we take them for granted.
- Structured Programming
- Object Oriented Programming.
In this series of Articles I will like to talk
about Principles of Object Oriented Programming, called S O L I D.
These principles expose the dependency management aspects of OOD as opposed to
the conceptualization and modeling aspects. Certainly many people get value out
of these aspects of OOD. The principles, however, focus very tightly on
dependency management.
So five principles of Object Oriented Design are:
Single
Responsibility Principle (SRP) |
A class
should have one, and only one, reason to change. |
Open
Closed Principle (OCP) |
You
should be able to extend a classes behaviour, without modifying it. |
Liskov
Substitution Principle (LSP) |
Derived
classes must be substitutable for their base classes. |
Dependency Inversion Principle (DIP) |
Depend on
abstractions, not on concretions. |
Interface
Segregation Principle (ISP) |
Make fine
grained interfaces that are client specific. |
These principles were pioneered and first
collected into a written work by Robert ‘Uncle Bob' Martin.
All these principles change your way of thinking about Dependency Management. I
will like to write use of each Principle in C# with detailed examples.
I will also like to highlight, the benefit of creating decoupled models, E.g.,
TDD and IOC Containers.
I will explain SRP IN C# in my next blog.