The Gold Standard

22 Sep 2023

When I began taking coding courses, I was solely focused on just getting the code to work. As long as there were no major errors and I got my desired output, I would submit my assignment. This was forgiven in my first two years of programming in high school CS courses but as I stepped into university, I was shocked when chunks of points were repeatedly deducted for my coding assignments. I checked in the feedback section of my moodle and saw the same line of message that while the code is functional, it does not follow coding standards and conventions.

I was puzzled. I wondered “Why should I care about rules and guidelines if the code runs? Isn’t that the objective?”. Well, to be honest, I was lazy. As the semester progressed and we did more group work, I could see how neglecting coding standards made my code difficult to read and understand to other students that did follow. It hindered collaboration efforts and development of the projects. Further to that, I could see a decline in code quality as I saw more bugs and errors that I had to fix during run time.

Bad Code

A colleague, seeing how less inclined I was to coding standards, told me that I should imagine it as building code. I can build any house, but for it to be livable, it should follow the building code. He told me I was building houses no one trusted to live in. This harsh but needed revelation gave me a new sense of appreciation for coding standards. Coding standards serve as a strong foundation for a well structured and maintainable codebase.

Yet, I was intimidated at first. The amount of coding standards, rules and standards to remember was overwhelming, which was why I was hesitant in the beginning as it looked like there were endless guidelines to adhere to. Cue the reason why I am so appreciative of ESLint. It gives instant feedback of coding issues and violations of coding standards so I can detect them earlier on. What’s more is that it will provide suggestions for specific fixes and corrections to your code.

ESLint Suggestion

When using ESLint, I had increased confidence in my code as it followed coding standards. When I see a red underline, I click on the red bulb and prompt it to make corrections. For 90% of the time, it changes it to do what I needed it to do. The confidence sways when I stumbled upon cases where the error message didn’t make sense as it was not straight-forward. This is the learning curve for ESLint from my view. Identifying the error and knowing which correction to make.

ESLint Error

I can understand how using ESLint can create a fear of impact. If I switch this on, with its error detection, can it lead to a domino effect that breaks the structure of code I had? During the Workouts of the Day that we had, I had spent some time making corrections that opened up other errors that needed corrections. However, these encounters teach me what kind of common errors pop up and I can gradually improve.

Tools like ESLint are a great way of introducing students to the world of coding standards and imparting ways of writing cleaner code to meet the golden standard.