The Code Is More What You'd Call 'Guidelines'

22 Sep 2022

As Captain Hector Barbossa said in the 2003 smash hit “Pirates of the Caribbean: The Curse of the Black Pearl”…“Coding standards are more what you’d call ‘guidelines’”.

Ok, he might have not said exactly that, but the point still stands. Coding standards are simply recommendations on how to style your code. Should you use tab instead of four spaces. How should your comments look. When should you leave comments. Do you need a comment to describe your functions? How should those look?

To many, myself included, an overabundance of rules and standards hampers productivity. You spend hours writing a magnificent, functioning piece of code with comments spread throughout to explain sections that were particularly difficult to solve. Then just before you’re ready to hit commit…you remember the coding standards that are imposed on every bit of code you write. For the next several hours, you slave away adding what you think are unnecessary comments and checking spaces and indentations. Total busywork that goes completely unappreciated and no one will even notice you didn’t style your code correctly until something goes wrong and they dig through the code to find that one small section you didnt style correctly.

Is the good Captain right?

When I’m conforming my code to standard, I never think it’s worth it. I could be spending my time doing other things. But at the end of the day, the entirety of human civilisation is built upon laws and rules that keep everything in line and functioning smoothly. It is this structure that makes things predictable and easy to maneuver around. Imagine having your house re-organized every day. Everything is still there, but you spend an unnecessary amount of time just trying to find where the floor cleaner is after your dog has an accident.

When you have a small team of three people with their own coding styles, you want to be able to quickly look over all of their code without having to spend any additional time learning their format. Debugging and joining code together is so much quicker and easier if you know the general structure of the code with barely a glance. There is a vast difference between a well structured comment that describes what a function does, the parameters, and expected output than one that is just a short, unhelpful sentence or a block of text that you have to spend time reading through to get that one nugget of info you need.

So while Ms. Swann might not have agreed with Captain Barbossa initially, she would come around and end up saying almost the exact same words to the Black Pearl’s crew. Because she knows that they are more like suggestions than hard and fast rules, but by adhering to these guidelines, you put in the work now to greatly simplify life later on, and especially when you’re in a pickle and need answers fast.