The Importance of Proper Coding Standards

09 Feb 2017

Introducing proper coding standards when writing any code is essential in making sure you code is organized and easy to read from those other than the person who coded it. Following proper coding standard can seem very meticulous and troublesome to do, especially for new programmers. It is very important to get use to writing your code in a proper coding standard. While writing simple code that only one person will be using may be fine not following the standards, but when writing code that will then be someone else project later on in the codes lifeline or having multiple people on the same project can make it easier for other people to follow your code and understand what is happening in your code. This allows others to not have to spend time understanding your code and in a professional environment, time is money, so you are saving people from having to waste their time understand your code and even maybe have to change your code so others can understand it.

While keeping your code following proper coding conventions, I find it kinda troublesome. I know of the importance of having a proper coding convention, since I have worked on projects with other people on it. It is just that it can be quite troublesome to deal with it and make sure that certain things are formatted correctly. I follow the simple ones like indent lines is a result of a line of code nested in something like an if or else. Also it is hard to remember what some of the coding convention, but most IDE have an option to include some sort of coding convention to check you code while you write it. An example of one of these plugins for an IDE is ESLint.

I have been using ESLint for about a week in the IDE Intellij. In the top right corner there is an indicator that can tell you if your code is all good or has something thing wrong. Having it there can be helpful for things like syntax errors, because it will mark the line area in red with a exclamation point in a red circle for the indicator. That isn’t too bad about having the coding standard plugin, what is quite troublesome is the warnings they give. It uses the same sign as errors, but with a yellow triangle. This is by far the most troublesome, because having those yellow warning in your code can be bothersome because even though your code would work perfectly fine as is, it is telling me that my code looks ugly. For some people, they can just ignore these warnings, but for me it bothers me a little and since when I get in the zone with coding something, I tend to ignore using proper coding standards, having the IDE perform the simple automatic one. Though after all is said and done, I then have to deal with fixing what I just coded because ESLint doesn’t like how my code is formatted.

Though I find it troublesome, it is still an important thing to follow. For the current projects I am part of, I try to make sure I follow some sort of coding convention. For example instead of leaving all the code for something on a single file, separating it in multiple files, like on that is holds the controller and one that holds services. Also keeping certain formatting for the code I write and how spacing between certain characters and brackets are space. This allows me and others who look at my code to be easier to read. I know how important that can be, as someone who has read a lot of other people’s code not being able to fully understand the structure of how the code was written, has caused me to spend a lot of time decoding it and in a professional environment, time is money.