Don't tell me what to do!

21 Sep 2017

Coding Standards: A set of guidelines for a specific programming language that recommend programming style, practices, and methods for each aspect of a program written in that language.

There are two types of people in this world: Those who look at that definition and go "Yeah, seems about right", and those go "Pfft, That's stupid. I'll code the way that I want to code". In a perfect world, everyone will be the former and follow coding standards because it makes sense. But unfortunately, a perfect world does not exist. Instead, we have a few of the former, but also a nice handful of the latter. I can't blame them. I mean, who likes being told what to do? Does it really matter if I put that extra line after the end of my code? Who cares if I indent with two spaces instead of three? In the end, my code runs fine and that's all that matters... right?

Let me paint a picture for you: It's your first day at Starbucks (exciting right?). Now you're expected to go through a few days of training. On day one, your trainer teaches you how to take orders and you are expected to write those orders on the cup, then pass it onto the barista who then makes the order. Let's say "ordering standards" don't exist in this Starbucks. So you take orders and write them on the cup how you prefer. You don't want to write the entirety of the order because it'll take to long and your line is growing. So, you abbreviate it. You then pass it to the barista and they look at your cup in confusion. They're having a hard time deciphering what exactly "iced cm" means. Iced Caramel Macchiato? Iced Chocolate Mocha? Iced Coffee Medium? They ask you what you mean and you explain to them that it's Iced Caramel Macchiato. I mean, what else could it mean? It makes perfect sense to you so how could they not get it? You both then go through this never ending loop of "what does this stand for?" and before you know it, orders are piling up and ticket times are getting a bit longer than expected. In the end, you both are worn out and many customers patience were definitely put to the test. So what could have been done to prevent this tornado of explained abbreviations that had just occurred? Ordering standards: A specific set of styles and abbreviations agreed upon by the staff so that there is a mutual understanding of "the cup". With ordering standards, there lies an abbreviation for each drink and a certain area of the cup of which to write certain specifications the customer requests. Now on day two, there is no miscommunication between cashier and barista, and everyone goes home happy and heavily caffinated.

Coding standards work the same exact way. Having one set style of programming language promotes better communication between those working on the same project. To be fair, I, myself, stared at the face of these coding standards brought to us by ESLint with a little bit of doubt because it was disheartening to be told "hey I know you've been coding a certain way for a long time, but drop all that and code like this now". However, after a bit of an adjustment period, I looked at it again in a new light. Looking at the bigger picture, it makes perfect sense. Many people dread the idea of working with others because of the constant battle of clashing ideas, but realistically, it's bound to happen. In many careers, you're going to be working with many other developers on many different big time projects and in order for that to work, there has to be some common ground in terms of coding style. Coding standards are put in a way to create unity between different programmers. It makes the process of working together take place in a much more timely manner if people spend less time trying to decipher each others code, and more time working on the actual task at hand. With coding standards, your team finishes the project in record time because everyone is on the same page. It is also useful in school assignments when you're stuck on a certain problem and want either your professor or fellow classmate to take a look at your code. With coding standards, it makes navigation through your code for your professor or peer run smoothly and they are able to help you in no time.

In my Software Engineering class, we've spent the entirety of this week using a specific coding standard that was strictly enforced upon us by what is called ESLint. When writing code, it would create those red squggly lines (that we all know and love through using things like Microsoft Word) under certain parts of our code that does not comply to our classrooms set of coding standards. Once all the red squiggly lines are satisfied and leave the page, only then does that holy green checkmark appear at the top right of our Javascript file, saying that everything is up to par. It's almost rewarding to finish an assignment and recieve a green checkmark as if we have passed this milestone that we have spent the last hour (or more) working on. I'm sure as time goes on, it will became so trivial to follow coding standards that we won't even need to see the green checkmark to know we are on the right track and what was a once a nuisance to most students, will now be what made us not only better programmers, but better communicators as well.