The Importance of Coding Standards

09 Feb 2017

Introduction

In the field of engineering you often hear, “if it’s not broken, why fix it?” However, producing quality code is more than creating a function or program that just works. Quality code is determined by its potential to allow others to make improvements or implement additional functionality to it. Others should be able to look at your code and think of ways to take your ideas even further; this all begins with good coding standards.

Quality vs. Quantity

I’ve been asked many times by peers to review their code, and have had the displeasure of politely declining because there was too much clutter. It baffled me how many people thought that the amount of code they had written, correlated with its quality. When I first started learning C++, I compared writing code to writing an essay. Nobody wants to read your essay if it’s filled with content that nobody understands or adds nothing to your discussion. Although you may have met the submission requirements of 3-4 pages, double-spaced, it does not mean your essay is A+ material. I figured that the same rule applied to writing code; nobody wants to read 200+ lines of code if it could’ve been written in five. It was from then on, I promised to others’ lives easier by writing good, simple, clean code.

IntelliJ and ESLint

Using IntelliJ and ESLint has made programming in JavaScript that much easier. JSFiddle is great, but not having a tool to check your syntax can make life difficult when writing code. Although I appreciate the utility provided by ESLint, I have mixed feelings about its coding standards. It flags you on every little detail, down to whether or not there is a space between the curly brace and the end of a parameter’s closing parenthesis when creating a function. I love that it makes writing code with others much easier, it strips away my freedom to write clean code the way I want to. It is definitely not worth my time working to get that green checkmark, when I know that my code is written well enough to read.

The Bottom Line

I believe that good coding standards lies within writing simple, effective, code that can be read easily by others. It forces you to think thoroughly of how your code works, and how you can improve it so that others can work with it. Additionally, I believe that development tools such as IntelliJ and ESLint are great but, I think they hand-hold too much, and could ease up a little on correcting every little mistake.