In the section of the book called "Ace the Programming Interview: 160 Questions and Answers for
Success" by Edward Guinness entitled "Understanding the SOLID Principles", the author tells us about the meaning of SOLID. Even though I didn't know this term, I had already heard about the contributions of Robert
Martin to the world of good software practices. I could say that a very
important assertion was made at the beginning: "the more things you depend
on, the greater the chance something will go wrong". In my experience,
that is quite true and for that reason, I think that dependencies between
classes should be avoided as far as possible.
I think that the first
principle called "Single Responsibility Principle" is one of the easiest to
understand but at the same time one of the hardest to apply. To get a class to
have only one responsibility, there has to be a very good software design, but
developers must also devote time to code analysis (especially those that are
dedicated to maintenance). Otherwise, programmers will simply do what is faster
and simpler: Add code wherever it is going to work (Apparently) what was
requested by clients.
The principles with which I
do not agree at all are "Open / Closed Principle" and "Liskov
Substitution Principle" since I believe that the base classes should have
the flexibility to be modified as long as the repercussions of the modification
are understood. On the other hand, I think that classes must certainly be made
to be extended or replaced by functions, since in this way it is easier to add
future changes without having to analyze too much (which is quite useful when
delivery times are very limited).
The principle called
"Interface Segregation Principle" seems very true to me. I think it
is very important to keep the code in small fragments so that they are
understandable and reusable at the same time without wasting resources
(unnecessary code fragments).
Finally, I believe that
"Dependency Inversion Principle" is extremely important for static
typing languages since by using this tool, the dependency between the concrete
classes is minimized.
No hay comentarios.:
Publicar un comentario