miércoles, 21 de febrero de 2018

Blog Activity: Understanding the SOLID Principles

SOLID principles are a good option to provide refraction or in other word to optimize the code that were creating, these kind of tips and tools helps programmers to get the right idea and the best structure to create a program.

For the SRP it’s important to keep an eye on what is going to be removed from the code, if it provoke an issue or something important is removed then it could impact in a negative way the result or the expected exit from the program.

Now, for the OCP keeping the most important stuff as private and that could not be modified, but for some other sharing issues we find a common problem when creating a new class that inherit from another, one thing that I can use also for some programming languages are friendly classes, for me is the best answer to solve this kind of problems when we share between some classes information or content and that other class is not able to use.

LSP is another element for the code to get every class working and cooperate between each one, the only thing here is that in this principle modification is allowed, sometimes this option is a good one because you don't depend too much on inheritance and could make the code independent for each class, this does not mean that you need to discard everything of inheritance, but to reduce the amount of use.

For ISP, looks simple and to have difference classes with the function each one can call is a good idea, you avoid any issue from memory and to execute classes that now the program that is running does not require it.

Finally, for DIP, instead of making references to classes, with this principle we can create reference to interfaces or abstract classes.


Every part of the structure of a code is very important not only for the syntax, but also for the way the programmer writes the code, once we remember this and apply (of course) you are going to be able to create and design code in no time.

No hay comentarios:

Publicar un comentario