In the second week of my blog I will continue to talk about the Design Principles. These are the first steps that each of us learn when we are introduced with the world of programming. The first week I talked about the importance of OOC and how to get out of a bad OOC case. Today I want to talk about SOLID. Computer science and their acronyms, never ending.
What does Solid stands for? Probably you all know but I will explain it anyway. S.O.L.I.D is an acronym that represents five principles of object-oriented programming and code design theorized by Robert C. Martin also known as Uncle Bob.
[S]ingle Responsibility Principle
[O]pen/Closed Principle
[L]iskov Substitution Principle
[I]nterface Segregation Principle
[D]ependency Inversion Principle
The goal of the principles is to make it easier to develop, maintain, and scale. They also make it easy to recognize and avoid code smells as well as improving the refactorability of your code.
The reason why I choose this topic is that I like everything that makes my life easier. And these principles have helped me a lot in my programming experience. I used to do a lot of repetition in my code, so these principles helped me understand how to code better. Remember “Do not repeat yourself”. SOLID it makes your software easier to implement and prevents unexpected side-effects of future changes.
I researched and read a lot about Solid principles, to understand the concept and how to apply it. There are tons of examples, books, websites that are nice, help you with anything that is unclear. Stackify and Medium are two of my favorites in this topic. They show the importance of SOLID and apply it in code examples. Stackify it is more detailed, shows what a future developer should keep in mind, tips and tricks that you might you use it.
Simply learning and knowing these principles will not in itself make a person a better programmer. To truly be able to understand them you must apply them. If you cannot do that in the code base you have now, then work through practice problems applying them there. As you use them you will see why they are important and where they may not be the best choice. This is something that comes with time because it takes many experiences to get a full picture or how they can be applied. Whether you are just starting your career and learning the best ways to write code or have been at it for decades there is much to learn from just applying simple principles to the way you code.
From the blog CS@Worcester – Tech, Guaranteed by mshkurti and used with permission of the author. All other rights reserved by the author.