Ps and Qs

20 Sep 2018

You’ve finally finished. You spent all day and night working to complete the homework, and as you scroll through your code, you’re actually proud of what you’ve done. As you hit submit, a sigh of relief leaves your chest, like a composer after a sold out show. Yet, when grades are released, not only did you fail to get full credit, but you scored lower than you ever have! How could this happen! There must be a mistake, it was perfect! If you’ve ever taken a computer science class, then you understand the stress and oftentimes prolonged frustration that comes with coding standards.

Coding standards when it comes to content

These standards tend to have no effect on the actual outcome of your code, or how it operates. For example: If you’re assigned as a construction worker to make a building only for a movie set, then all you need to create is the outside. It looks nice and pretty, just like an ordinary building should, but has nothing inside. No furniture, no foundation, no structural integrity. It simply gets the job done. Coding standards are the grammar, the structure of your language; whether it be Java, JS, SQL, etc. They provide readability, a common law that brings all different kinds of algorithms and data structures and applications together under one roof. Without them, there would be chaos.

A layman’s example

Imagine a world where there were no penalties in football. Whether it be American or European, it doesn’t matter. Goals would still be scored, tackles would still be made, and the sport would be generally the same. Yet, when John Madden doesn’t like what someone on the other team said, or Christiano Renaldo has been squabbling with his manager over a salary increase, no one is there to penalize the situation if things get out of hand. If Madden simply decided to drive his truck on the field and chase down the opposition, no one would be there to stop him. A much more extreme example is The Purge, where 12 hours of lawless behavior simply doesn’t end up well.

Bottom line

Regardless of how annoying inserting an extra space before declaring a function might be, it’s theses small things that give coding a sense of formality, professionalism: a frame for the reader to look into and understand exactly what’s being said. Without them, who knows where we’d be.