
Coding standards are in my opinion, quite crucial to programming. Consistency is indeed KEY. When it comes to a task like programming, it’s important to be exact and precise. We’re talking about computers and machines that only understand and communicate with 1s and 0s. Everything should be absolute. Now in practice, not everything is always to clear and simple. There’s always a variety of issues that one may run into while programming that can be caused by a whole slew of things. One example of an area that allows room for much variation is the concept of “coding standards.” This is something that isn’t always the most well defined, isn’t always the most consistent, and but is a big part of the “human” side of programming. It’s one of the areas where you can tell one person’s code from another. This human aspect of variation and uniqueness. While it may be one of our best features as a species, in terms of coding standards, it can introduce some frustration.
Look, when it comes to coding standards everyone has a different opinion. Whether it be due to plain comfort from how someone originally learned coding or evidence based reasoning from experimentation, people stick to what they love and will fight for it. Regardless of who’s necessarily right or wrong, what should really be focused on is the purpose of having a particular standard. Most standards are for either efficiency or for ease of reading. My take is that coding standards should obviously emphasize some level of efficiency but mainly ease of reading and ease of writing. It doesn’t matter how efficient some code may be if it’s extremely hard to understand and parse through. If everyone can easily understand the code, it naturally will benefit efficiency in a different way. Now in regards to ease of writing, nobody wants to struggle with the formatting of their code. Coding standards should cater to easier and more convenient method of writing code. This will also benefit efficiency in the same way that ease of reading will do.
The one other key component is to allow for some room for flexibility. For example ESLint yells at you for various minuscule issues like the exact amount of indentation, using single quotes instead of double quotes, requiring a new line even if it’s the end of the program, or not using the most appropriate declaration keyword. All of these things perhaps do have a valid reason for their enforcement, do they really matter so much at the end of the day? No. The types of things that should be enforced are using a new line instead of typing everything on one, just some form of indentation, and putting new lines between functions. Not every little thing needs to be the exact same across everyone. People have preferences, even if the reasoning behind them might be a bit backwards. Ease is EVERYTHING. Going back to how ESLint doesn’t like it when you have a 4 space indentation instead of 2 is pretty dumb if the 4 space indentation is what you automatically get from hitting the tab key. Putting a two space indentation would instead require you to hit the spacebar two times. Also the 4 space indentation or wider indentation using the tab key is just nicer to look at because everything will be more spread out and visually appealing. This type of thing should not be happening.
So at the end of the day, be smart and mindful about how you format your code but just don’t be a stickler for every little thing. Accept that people may prefer things slightly different than you. That’s perfectly fine. Coding standards should be for helping each other out