Coding standards. Some people love them, some people hate them, but do we really need them? Are those spaces between brackets really that important? Honestly, one could think “If the code runs, why fix it?”. But there is more than meets the eye. To many people, a coding standard truly is, a diamond in the rough.
A student might roll their eyes at all the warnings thrown by their IDE. “Finally finished the project! But ughhhh now I have to go back and fix my code”. Yes it is a pain in the butt to go back and fix it up, but what can be learned can be unlearned. Habits can change. Simply write the code right the first time. There are many benefits to following code standards.
Lets say you are working with 20 other people on a project and everyone has a different way of writing code. Your best friend John absolutely LOVES his “Enter” button. Mashes it all the time. His code has gaps and looks messy. Your other friend Jane is the complete opposite of John and hardly uses her “Enter” button, spewing out long strings of data. Now imagine being the one trying to read this mess. You would spend more time figuring out what goes where than actually reading the code. Highly inefficient! As The Beach Boys said, “And wouldn’t it be nice to live together, in the kind of world where we belong?” Coding standards allow everyone to be on the same page when looking at each other’s code.
Let’s imagine you are learning how to code, which all of us should always be. It would be a lot simpler for you if you are diving into a new language and are able to recognize patterns and how things function. Wouldn’t it be nice if we had, the same nomenclature in our code? Wouldn’t it be nice if we didn’t wonder, “what is this and where does it belong?”
Coding standards could also alleviate security concerns. For example, it is often the standard that the function “gets()” should not be used in C because it poses a security concern. Making this a standard can help keep your project secure. A coding standard is also beneficial when fixing bugs. It would be much easier to identify abnormalities if the rest of the code is written in a standard manner.
The best part is that a coding standard makes a project easy to maintain in the long run. Suppose you are working at a huge company on a huge project that’s been running for 10 years. It may have had hundreds of people working on it. If there were no coding standards it would be like reading a book but in a hundred different fonts. The beauty of coding standards is having a hundred people’s worth of code seem like a single person wrote it. There is readability and minimal complexity. Beauty.
“You know it seems the more we talk about it
It only makes it worse to live without it
But let's talk about it
Oh, wouldn't it be nice?”
-The Beach Boys