Understanding the SOLID Principles

SOLID principles are just perfect when we want to reduce the possibility of things getting out of control, this is by minimizing class dependencies, also the SOLID principles offer some guidance as to what we use or what we do not. However, at the very beginning some of the most fundamental SOLID principles seem to be directly on conflict with Object Oriented Programming paradigm, we need to take a rational approach when looking at them. Most of the time when we get the opportunity to experiment with different programming paradigms begin to get excited, and also, we want to make full use of all its features, benefits, and qualities and we don’t really get to think about the quality of the development of a project.
For reference here, they are:
-Single responsibility principle: This principle advocates for single-purpose classes although most of its functionalities can be singled out in several individual tools that may achieve the job in a better way.
 -Open/Closed principle: Open for extension, closed for modification. Instead of changing some class behaviors, it might be a better practice to increase them with some new ones, especially if there are classes that inherit these behaviors.
 -Liskov substitution principle: This principle advocates for non-modification of inherited methods, as to ensure that both classes are interchangeable which is a direct counterpoint towards inheritance and polymorphism which are two of the main practices on Object Oriented Programming paradigm, as we can see it is similar to the last principle.
 -Interface Segregation principle: This principle advocates for making interfaces as to not burden a class with too many behaviors and features that in the end will never ever use.
 -Dependency inversion principle: With this principle, as developer you’ll have to make sure to make your classes dependable of abstracts instead of concretes given that the fact that concretes tend to change while abstracts are generally idle. In my opinion this is an interestingly difficult paradigm to learn because it helps you to get out from your comfort zone.

Comentarios

Entradas populares