Why SOLID is important?
Evident and yet sometimes ignored situations where SOLID may help
What
If you have been a developer for a while, you probably already know the acronym above. It represents a set of 5 programming principles that offer guidance and useful advice when coding. Each one of these represents a coding design technic made to avoid well-known problems.
Each one of these represents a coding design technic made to avoid well-known problems
It is not my intention here to go through each one of the principles. You can easily find plenty of articles out there discussing each of them deeply. Instead, I merely intend to share with you my own experience regarding it, and some satisfying outcomes I believe also be reachable by any team.
The Journey
I have been working as a developer for a long time now. Along the way, I have the pleasure to be taught by amazing people with different points of view and opinions about SOLID.
There were those with a deep understanding of each principle. Others that had no idea what each letter stands for, but given years of experience had already assimilated the practices into their way to do things. And some have just read something online to use during the interview process — I was one of those years ago.
Get Guilherme V.’s stories in your inbox
Join Medium for free to get updates from this writer.
I admit that it took me a while to see the value behind what seemed to be in most cheap talk of senior developers. I pretty much ignored the principles until I become technically responsible for projects and teach other developers. At this moment, I started to notice some interesting and recurring facts:
- Commonly, the concern with code quality is present, just as the question: “How do I know what I am building is right?”.
- Giving code feedback while reviewing PRs is not an easy task. Programming involves creativity, creativity leads to different paths and different solutions. If you put into the equation variables like overengineering and proud programmers, you may end up in a sensible scenario.
- Eventually, people will — without any reason — let/hope just time itself ends up proving the solution they imagined is a good one.
- Sometimes, programmers smell something seem do not fit, but had no idea why, or even what.
- Business is not concerned about how things are done. They just want the flexibility they need to validate ideas and iterate faster.
IMHO the problems listed above can be solved in many different ways, but this is a post about SOLID. I just want to show how remembering it exists can help you when dealing with these problems.
When looking at the first situation, “How do I know what I am building is right?”. Well, I do not believe there is a silver bullet to be used here, or we probably would see fewer bugs out there. But this is why we created principles in the first place, to show us a direction when things are not exactly clean.
To the second situation, the "PRs reviewer" situation. Maybe would be better to avoid opinionated discussions and try to elaborate arguments around well-established information. If you bring principles to the conversation at this point, a common ground is placed, and the chances are everything will be handled easier, and with better results.
About the third situation, the “let time proves I am right” situation. First, let state the obvious, the phrase would be better put this way: “Let time proves or business pay.” There is no reason why not to take 5 minutes and check the solution against principles. Sometimes, some of them will not make sense of the situation. But in other, it will be time worth spending.
About the fourth situation, the “something smells wrong” situation. This is a classical one, and I let you with this article from Uncle Bob answering it. He explains it better than I ever could, and the link is for sure a worth reading.
And finally the last one, the “business” situation. Business wants to iterate faster, so flexibility is a requirement. In terms of programming, flexibility means low coupling here. And all the point around SOLID principles is that they were designed to dodge well-known traps and to make it easy to apply changes in your code.
Conclusion
It is important to understand that SOLID Principles do not represent an absolute truth, and to every case, there is always an exception. Adhering to them will not turn you instantly into a skilled programmer, neither the code you write immediately in a good one. But they represent a solid step in the right direction and a vaccine against different classes of daily problems when they are not forgotten in your skillset.








