Quality Assurance

18 Sep 2017

At just the mention of the words “coding standards,” I can already hear the classic argument breaking out in my head: should code be indented with the tab key or with two presses of the spacebar? If you use the tab key, why don’t you just set your tab key so that pressing it causes it to indent two spaces? Although this is a simple example, the point here still stands. Enforcing a universal coding standard would be extremely difficult, so what’s the point? In reality, however, a perfect world with a universal standard for coding would be efficient beyond belief.

What's so good about coding standards?

Just imagine it–you wake up to work on the project that your team has been assigned but someone in a timezone a few hours ahead of you has already pushed a new commit to github. Sure, you’ve never met your teammate in person and you both know different languages. But because there’s a universal standard to how code is written, you know exactly what you’re looking at when you look at the code that has all so suddenly been put in front of you. Curly braces are exactly where you expect them to be, usage between for loops, while loops, switch cases, etc. are all used in exactly the situations you’d expect, everything is properly documented. There would be no need to have team meeting to discuss updates that other members of the team have made, and when learning a new programming language, everyone would be on the same page. When you try to ask the question, “How should I write code to do this?” or “How do I use this feature?” you won’t get the answer “Oh, there are many ways to do that, but what I recommend is X.”

Well I don't want to learn new coding standards.

To be fair, to people who have already learned a language or who are already accustomed to certain methods or certain rules, it would be difficult to have to switch from their current style of coding to a new universal standard. Even I myself would have to change how I write code, and it might take me a while to make writing code using a new standard a habit. However, I think the greater good of having everyone on the same standard would vastly outweigh the amount of effort I would have to put in to change my personal style of coding. For this reason, I believe that even on relatively small scale projects, for example a college class or a single company, that making such a change would be extremely beneficial to every member involved. If everyone were to just adhere to the same basic rules, we could all spend less time asking questions and trying to make sense of other people’s code, and spend more time trying to fix actual problems.