The Power of Coding Standards

09 Feb 2023

Readability, Readability, Readability

“Readability, readability, and readability” is what is being drilled into software developers in modern-day programming. Long gone are the days of writing code to minimize the space used, now every programmer today is expected to write high-quality and readable code. But how exactly do you write readable code? Luckily, following a set of coding standards is one approach to code readability. Some examples of code standards range from, the number of spaces to indent, the position of curly braces, and the max number of characters each line can be, to more complex standards like only using a try-catch block for tests and limiting the use of global variables. Code standards are very arbitrary and change depending on the environment you are in, whether you are taking college computer science courses, writing code for your employer at a software developer job, or you are with a group of friends participating in a hackathon. Coding standards are not only good to follow for yourself, but for a group of people working on the same project. When there is a set of coding standards, every person contributing to the coding project will write similar styles of code, keeping everyone on the same page. These standards force you to write readable code so that your teammates can better understand what you have written, even if you did not write comments for your code.

Like Cornell Notes

I believe coding standards can actually help you to learn a programming language. When you first learn a programming language, it is common to have very unorganized and cluttered code all over the place. As you are learning, you will look back at your code like a set of notes but realize you have no idea what you just wrote because of how messy it is. Since coding standards make your code more readable, following those standards will make your own code easier to understand, debug, maintain, and improve. Code standards to code are like Cornell notes to notes. They both standardize the procedure of doing said action and make it easier for peers to understand thanks to the set of rules that you must follow.

The Power of ESLint!

ESLint is a great linter to use to help you follow a set of coding standards. When integrating it with IntelliJ, it automatically marks code that does not follow coding standards with a red-squiggly line. After my first week of using ESLint with IntelliJ, I found it to be very useful in helping me write cleaner and more readable code. One very nice feature when integrating ESLint with IntelliJ is that you can write click on your code and press a button that will automatically fix all your ESLint errors, instantly cleaning up your code. One thing I do find annoying is that because the red-squiggly error lines appear in live time, I get bombarded with error messages when I have only written the framework of a function. In that case, I would prefer to only turn on ESLint when I have finished my code. However, if I were to use ESLint like that, it may take up a large chunk of my time fixing code standard issues, rather than just fixing the moment I write that line of code. Once you have fixed all your code standard issues, you a presented with a small green checkbox denoting that there are no errors in your code. I find it quite satisfying to see and every programmer who uses ESLint should aim for that green checkmark.