Code standards

08 Feb 2018

I’ve learned programming from primarily formal education, and so, coding standards didn’t seem like a strange or new thing per se, but rather just something extra you had to make sure to follow to get a good grade, done even without necessarily considering why you’re being required to use a particular style. This has its pros and cons; on the plus side, it’s easy to adopt a new set of standards or different style, especially with tools like an IDE to help automate parts of the process. It’s not much different than changing from using one writing style to another, MLA or APA for example, as preferred by the course instructor. However the real benefits of adhering to a coding standard may be hidden to the writer, and code written without following a style you’re familiar with may at first glance be slightly more confusing and take a little more work to parse.

good application of Coding standards provide numerous benefits by enforcing a consistent set of rules for specific features of code, this helps by making the code more readable, more immediately understandable, more logically grouped, and makes more explicitly clear what code belongs to what scope. This allows you to write better code that is less prone to bugs because of how the style of code is formalized, and often bugs that do appear are somewhat easier to find because of the clearer organization. The main trouble with using coding standards is getting that good application, consistent across all code and well enforced. This is where the benefits of automation and IDE’s come into play. Using a coding standard for Javascript, for example, ESlint combined with a good IDE has been extremely useful as you can see violations of code standard as you type both allowing you to correct them as you go. In addition, the standard that is being violated is also listed and you can jump to each violation in the code, teaching you how to write the code to avoid those problems without needing to dedicate extra time to studying a standard.

Applying coding standards with many of the useful tools available seems likely to pay dividends on the work to get a system down with the time and effort saved in more quickly understanding and debugging code.