SOLID is an acronym for a set of 5 design patterns in object-oriented design(OOD). It was written by Robert C. Martin in 2000 in the essay Design Principles and Design Patterns. I would suggest a read-through of the essay once. The term was later coined by Micheal Feathers.
SOLID expands into:
- S - Single-responsibility Principle
- O - Open-closed Principle
- L - Liskov Substitution Principle
- I - Interface Segregation Principle
- D - Dependency Inversion Principle
All these are patterns that are used daily by software engineers around the world for the advantages they provide. You might have come across them in your daily work but might not know these terms. Without proper design of software, we would end up with a lot of issues. Martin calls this Rotting Design. Software designed by designers always starts clean, elegant, and compelling. But it slowly starts to degrade as more and more changes are to be done to the program to meet newer requirements.
There are four main symptoms of rotting design. They are interlinked with each other. They are
- The viscosity of design - It’s easier to change something by not following the design. These changes are some form of hack, to directly change something rather than following the design. This will eventually lead to issues down the road.
- The viscosity of the environment - If it takes longer compile times, developers will try to avoid changes that involve recompiling the code. If it takes longer to check in the code and get it deployed, changes would be tried in such a way it takes the least check-ins.
Now that we have gone through the symptoms, what causes design rot? Well, it’s usually due to one of the following 2 reasons,
So, how will we fix this? We can do that by implementing dependency firewalls between modules. Dependencies don’t propagate across these firewalls. Object-oriented design is full of patterns to solve this dependency management of modules.
We will look at each of the principles in detail in further posts.