Reflecting on Coding Standards

24 Sep 2024

Introduction

When most people think of “coding standards” they think of trivial issues like how many spaces to indent, or where to place the curly braces. While those details might seem minor, coding standards play a huge role in software engineering. I personally believe that one of the easiest ways to improve the quality of one’s code is by simply improving their coding standards.

Coding Standards as Tools

One of the many benefits of coding standards is that they improve one’s ability to use a specific programming language. When you follow a structured set of coding standards, you’re learning how to correctly structure your code, as well as making it neat. For example, ESLint can enforce rules around coding practices such as variable naming and proper error handling. These rules help improve the coder’s ability to write clear and efficient code.

In my experience, coding standards enforced by tools like ESLint help take the burden off of me when it comes to organizing my code. It saves me the mental effort of figuring out how to best format my work, which allows me to spend more energy focused on actually solving the problem. Over time, I have come to really appreciate that the patterns enforced by coding standards have improved my ability to write clean code without much effort.

My Experience with ESLint

After my first week of using ESLint in VSCode, I have experienced a mixture of both appreciation and frustration. On one hand, I appreciate the fact that ESLint keeps my code neat without me having to worry about it. It is reassuring to know that the tool is doing the thinking for me - allowing me more time to focus on actually writing my code. The satisfaction of having code that’s free from obvious issues such as unused variables is rewarding, and the process gives me a lot of peace of mind.

However, on the other hand, the red squiggly lines in VSCode pop up before I even finish typing which can be distracting, as well as annoying. ESLint’s pattern of pointing out errors can be overwhelming, especially when I am in the middle of a thought process and ESLint flags incomplete code as problematic. For example, when I write the return type of a function, but have not typed the actual return statement yet, ESLint will flag the function’s return type which can be very irritating.

When comparing both the pros and cons of ESLint, I think the benefits outweigh the negatives. While it can be frustrating in the moment, the red squiggles push me to resolve issues immediately which challenges me to constantly improve the state of my code. In the end, it encourages me to build a habit of writing error-free code.

Consistency and Collaboration

Another major advantage of coding standards, such as those enforced by ESLint, is that they make collaboration smoother. When working with other developers, consistency in coding style is crucial. Without coding standards, team members with differing coding styles could end up each implementing code in a project that is vastly different, which makes the code messy and harder to maintain. When using ESLint for a group project for my ICS311 class, I noticed that ESLint doesn’t just keep my own code clean, but also ensures that the entire team is following the same rules. This reduces the time it takes to read and understand someone else’s code because everything is written in a structured, uniform way.

Conclusion

In my opinion, coding standards, particularly those enforced by ESLint, are one of the most effective techniques for ensuring high quality code. They not only help you to fully understand a coding language, but also keep your code neat and make collaboration easier. While the immediate feedback of ESLint can be frustrating, especially with the red squiggly lines in VSCode, the benefits far outweigh that temporary frustration. Coding standards are not just about small details - but about building a habit of quality and efficiency in one’s programming habits. Therefore, I think that they are a key element of software development.