GOOD PRACTICES WHEN PROGRAMMING

Many developers, especially the newer ones, focus only on the project they are carrying out looking, and working well, which although it is extremely important, they continue to leave out.

In my opinion, something equally, and I might dare to say the most important thing, is to follow good development practices which will allow not only that someone else can help implement new features but also the code will look cleaner and more organized.

So I would like to give you some tips on how to apply these good practices (in this case I will use a project made in Flutter but these can be applied to other frameworks)

● MAKE YOUR CODE AS READABLE AS POSSIBLE

○ If you notice that a code fragment is being used in multiple parts of your project, maybe it is best to extract it to a function and call it when necessary, thus also avoiding that if the said function has an error in every place where it is implemented this can get correct it quickly.

○ Decide on a Naming Convention and don’t change it in the middle of the project for any variable in your project. Also, if you don’t know which one to choose, read the documentation for the language you are using, they may have a pre-established one for your use.

○ Name your variables according to the value for which they were created, not like the story of a teacher who woke up looking for an error due to a variable called xyz123

● KEEP YOUR FOLDERS AND FILES ORGANIZED

○ If your project uses many models, create a folder called models, move them all there and create a file called models that is in charge of exporting them all.

○ Try that the files that depend on each other are in the same folder, this will avoid having multiple folders open at the moment and it will be less dazzling on the eyes to see all those files and only be using 2 or 3.

● ALWAYS APPLY KISS AND, DIVIDE & CONQUER.

○ KISS (Keep It Simple, Stupid)

This is a principle that we can summarize in its very definition, the developer’s job is to provide simple solutions to complex problems, not the other way around.

○ Divide and Conquer

This is another equally important principle in which we take a task such as creating a user and divide it into subtasks that are easier to handle.

And finally, remember it is always good to copy and paste from StackOverflow but you have to know how to do it.


Posted by

Andrés Maldonado – Systems Engineer