After reading the section written by Edward Guinness, from the book "Programming Ace the Interview: 160 Questions and Answers for Success" I realize that most of them are very intuitive and not so difficult to understand.
For those who do not know the subject of which I will talk about, SOLID is an acronym that stands for five principles of object-oriented programming and design. These principles are:
- Single Responsibility Principle
- Open/Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion Principle
In short, each principle aims to avoid dependence between system components. To achieve this purpose, the classes must have a single function, the code must be open to be extended, but closed to modification, you should opt for the composition rather than inheritance and not add functionality that in the future may be irrelevant .
Despite I never had heard about these principles, when we use an object-oriented approach, from an early stage as programmer we learn to write code that can be reusable, maintainable, understandable, etc. I agree with the author that can often be difficult to know how we should apply each of these principles, since projects are often complex. However, I think if you start with a good overall system design, planning can be organized and therefore avoid common mistakes that can cause the project fail.
The SOLID principles are applied at the time of encoding, however, initially they have to be seen from the perspective of analysis and design.
It isn’t hard to see why some programmers develop superstitions about the systems they maintain.
It is interesting to see how the preceding sentence applies many times in our projects, since most of them lack a proper analysis and our code is held with tweezers, ie is too fragile to changes.
In conclusion, I found it very educational to read the subject, because it is always good to practice tips that can be useful to us and work cleaner and orderly manner. And how the author says about what to do when we do not know something, you must rely on experience and common sense.
0 comentarios:
Publicar un comentario