Coding Standards Improve What?

24 Sep 2020

In the first few semesters of computer science classes, we were exposed to a few different IDE’s. As I learned to type faster and spent more time with my eyes on the screen and less on the keyboard, I began to appreciate the autocomplete settings. I would type an opening curly brace and a closing one would appear, or a quotation mark would automatically be two quotations. Once I learned how to navigate these settings, I became faster, and several of the common syntax errors I was constantly typing vanished.

Those semesters were using C++, so far, the most syntax sensitive language I have used. The first couple of weeks were mostly focused on syntax. As I quickly learned, my code wouldn’t compile if I had been mistaken in syntax. The coding standard was, “Will it work?”

I took a few classes that were part of a Web Development Certificate program. Many of the languages that we coded in had an online code validation site available, and completing the validation was a part of our assignments. I figured out that sometimes just running the validation check on my code would highlight exactly where I was having problems. I could use the code checking sites to write code that worked as I wanted. We used W3C for HTML and CSS, Esprima for JavaScript, and PHPCodeChecker. These sites were checking syntax but searching for the correct syntax usually forced me to re-read documentation and forced more learning.

Later, my professors, had us add “coding standards” to our IDE’s. In the first semester, the professor explained the standards were his creation and that it helped make sure that grading was easier and that all of us had some uniformity to our code. I didn’t understand what I was doing as I followed the instructions, but I quickly saw that my code started to look like his. I also noticed when I would collaborate with my classmates, for the most part, I could understand what they were writing. This first coding standard template was mostly about syntax, so I could still code a lot of nonsense that at least looked “pretty’.

In my most recent class, in a new language, with a new IDE, I have a new coding standard. This time the coding standard was introduced with a GitHub repository. The source of this style guide, Airbnb, is a very large company and immediately this adds some credence to the professor’s instruction to install this coding style. The README file explains what and why some of the guide’s rules are.

This coding standard is the “strictest” I have used. At first, I hated it. I have developed a very sloppy yet fast method of coding. I had a sea of red-colored squiggles across my screen. I had to take my time to hover over every line and read what I did wrong, and how to fix it. Almost every fix could be implemented by the IDE if I clicked on the option. The few that I couldn’t click-to-fix needed me to review my code, my logic, and usually go back to the documentation to figure out the correct code. At first, my assignments took longer, but I have already noticed that I am coding a little smarter. All the referring to the documentation has helped.

Today we had a coding practice, or challenge if you prefer. They are timed, and the anxiety of the clock makes every keystroke seem more important. I don’t have time to bang out messy code and then go fix it, let alone time to get lost in confusing syntax or misapplied functions and methods. I noticed today though I was thinking slightly different as I coded. I wasn’t simply typing commands on my keyboards, I caught myself typing spaces and indents as importantly as letters and numbers. I have continued what feels to be a steady improvement in the class overall, and I feel a little more confident as I am doing it. Judging by the mountains of articles I have read about imposter syndrome lately, feeling confident is a huge benefit to get from a coding standard.