Coding Standards Are Great!

09 Feb 2021

The Start

When I first started working with code, one of the first things I noticed was the coding standards that people would use online and from those who teach programming languages. I quickly picked up the coding standard I use today that I learned from those who initially taught me how to code. The coding standard introduced to me was very easy to grasp as it made sense to me. What I mean by this is that the standards are there so it is more consistent when you look at another code and easier to look at. I could not imagine how coding would be if there were no standard and code blocks and indents were all over the lines.

In Comes ESLint and IntelliJ

When I started taking a software engineering course, it has been about two or more years since my last course that involved working on code. For that reason, I knew that I was going to be rusty, but the coding standard I learned still stuck with me and helped me deal with the rust over the years. Later on in the course, IntelliJ and ESLint were to be used for the majority of the time, and ESLint brought its code standard. As I am typing this, it has been about a week since ESLint has been installed with IntelliJ, and to be honest, I feel that almost every error I am coming across with ESLint is not how I am formatting my code, but because of my familiarity with IntelliJ.

The New Environment

When I initially installed IntelliJ, I thought it was going to feel the same as me using jGRASP or Vim, both of which I had used previously for other courses and personal uses. It turned out not to be the case. One of the key things that IntelliJ does differently from my observation compared to jGRASP or Vim was that it will automatically indent for you when going to the next line depending on the scope. This was not the case before, so whenever I created a new line, I would habitually press tab on my keyboard to indent. Since IntelliJ does this for me, I kept having extra indents on my lines and I would get errors from ESLint telling me that I have extra space.

The Linter

I know that eventually I will get used to IntelliJ automating certain actions for me and ESLint I think for the most part from my usage within about a week has almost the same standards that I have. One of the main things that it does differently from my standard that I usually do not catch is that it tries to correct my variables if it can be a constant or not, due to the variable not being reassigned for example. Another error that it tells me is that sometimes I can simplify certain expressions because that piece of code may just be redundant or unnecessary by ES6 standards and will try to do so by arrow functions for example. Although, seeing errors are a bit annoying and bug me that I want to fix it, it does feel satisfying to see that green checkmark showing that there are no more errors after fixing them. Other than that, the errors it sometimes shows can help me learn how to improve my code, be it from arrow functions or marking parts of the code that can have errors like missing a letter or usage. Before using ESLint, I do not think I ever had a linter or a proper tool that helped to fix my code, so I think the introduction of linters made me want to make sure I have one installed when working on code now.

So What Does This All Mean to Me?

After realizing the depth that the coding standards can have, it makes me want to improve my standards much more. Seeing improvements to my code like arrow functions is the reason for making me want to improve and learn efficient coding while maintaining a clean code standard. Using linters can point out errors that I can learn and improve on, or just simple mistakes like typos so I don’t have to go through the headache of troubleshooting through multiple lines of code. At the end of the day, if we did not have any coding standards, I think coding, in general, would look undesirable because of the potential mess there can be. This is why I conclude that coding standards are great and should be an important part for anyone who is going to be doing any sort of coding. Having these standards will make looking through your code easy without having the headache of where a certain error in your code is and helps with sharing code since those you share your code with will have the same coding standard they work or see in and won’t have troubles viewing your work. As long as your coding standards are consistent and everyone else keeps up with the same or similar standards, reviewing code and troubleshooting should be much easier.