SOLID

 

The SOLID principles are really good advice and were explained in a really simple way during this article. Some of them I had already heard as in the past I have read one of Uncle Bob’s books during the Videogame project course. The Single Responsibility Principle is the only one of the principles that until now I always have in mind while writing classes, although being honest just as the article says it is not always that straightforward what would be considered doing only one thing, so sometimes I may not apply it perfectly.

The Open/Closed Principle and the Liskov Substitution Principle those are principles that are new to me and certainly go against some of the things I knew.  Because I had learned to use inheritance in those situations, although reading the article I agree that abusing inheritance may not always be a good idea as it may leave the code in an unpleasant state or generate side effects.

The Interface Segregation Principle I never had thought about doing that, yet it is something so simple and makes a lot of sense. As it allows to only get the code you need, nothing more or less. It is important as it avoids classes to become bloated by unnecessary code.

Finally, the Dependency Inversion Principle was also one of those really simple things that seem so obvious, yet I never thought of before. The ability to just not create hard dependencies seems like such a useful one, and it does not require that much extra work. And not only that it also allows to substitute for any class that implements that interface, making it more flexible. Also, it reminds me about some of the design patterns we have studied in the course. I will try to be more mindful and apply this principles in future software.

Comentarios

Entradas populares de este blog

Is design dead?

Software Craftsmanship