DEV Community

Yeferson Guarin
Yeferson Guarin

Posted on • Edited on

Something you should know if you want to be a better developer

Hello friend, I hope everything is going well for you. Today I want to talk to you about a very important topic that you may have overlooked because the day-to-day eagerness did not give you the space to pause and reflect on it, but don't worry, it is something that almost all developers have past, but you learn from mistakes and I can help you to make them as little as possible. What I'm talking about is the SOLID principles, 5 principles that every good developer should know and apply in their day-to-day work. I will quickly explain what they consist of. The SOLID principles are a set of principles that guide us to apply good practices in the developments we make, seeking that our products have a very high quality (I will tell you about these quality criteria later)

Each of the initials of these principles has a meaning. The 'S' refers to "Single Responsibility Principle", that is, to make our developments in a modular way, where each module, function, library, component, as you want to call it, should only have one responsibility since with this we could understand more quickly makes our code and modify it without generating side effects, or replace it with another more efficient implementation.

The second principle, the 'O', refers to Open / Closed, this principle tells us that when we make a component of our development, it should be open to be extended, but closed to be modified (speaking of its inputs and outputs) , since with this we will guarantee that in the future our code continues to be compatible.

The third principle, the 'L' refers to the 'Liskov Substitution Principle', this may scare you or sound very bombastic, but this principle simply tells us that classes that inherit from other classes should be able to be replaced by their base classes without alter the correct operation of the software, this allows us to create different implementations of a functionality and to test them without having to modify the code.

The fourth principle, the 'I' refers to 'Interface Segregation Principle' another name that may scare us a bit, but in practice it is easy to understand, this principle tells us that we should make small and concrete interfaces, this In order not to force our components to implement functionalities that have nothing to do with their nature, it would be preferable that our class implements several small interfaces.

Finally, the fifth principle, the 'D' refers to 'Dependency Inversion Principle', once again, a name that may scare many, but when you understand its philosophy and its power, you will evolve as a developer. This principle tells us that our components should not depend on implementations (classes that implement interfaces or abstract classes), but on their abstractions, this in order to minimize the dependency between components and therefore have a low coupling, which will allow us make our software more extensible, maintainable, bearable among many other benefits.

As once, these principles are very important in the development world and are widely considered (although there is no shortage of criticism), so much so that it is almost a requirement that every experienced developer handle them and have the criteria of how and when to apply them, as well. I invite you to continue delving into this topic, which is sure to hook you.

Top comments (0)