Is it Up to Standard?

26 Sep 2024

Standards

As the world of coding languages quickly improves over time, our ability to write clean, well maintained, and high quality code becomes increasingly important. Writing code is no longer about being able to understand the code that you wrote yourself, but rather being able to understand and write code while working with your team. Now imagine everyone on the team wrote their code a different way. Nothing would ever get done, because they would be too busy trying to understand the code. This is where the importance of coding standards come in. Coding standards are important because it makes everyone code the same way, so that reading and understanding code is much easier to do.

My Experience

I was first introduced to coding standards in my second semester of college. Initially, I had just coded however I wanted. To me, as long as my code worked and I understood what was going on that was good enough. However, my professor at the time made it a point to follow the coding standards he had listed on his website, so I did. At first I thought that coding standards were more of a paint that anything. “Like why should I make my code a certain way? It wasn’t like anyone else was going to read it, and the TA’s were just going to run it to make sure that it worked.” However, as the assignments started to get harder and harder, I started to appreciate coding standards more. This is because I started to spend more time on my assignments and had to spread them out over the course of several days. Since I wasn’t able to complete the assignments in one go, I had to be able to understand what the code I created before did and what to do next. By using coding standards, I am able to easily understand my own code without having to try and remember what I was doing the previous time.

Benefits and Downsides

I think that coding standards also allow you to learn a new coding language more easily. For example, I had to quickly learn Javascript and Typescript for one of my classes. By making variables in camelCase, types in PascalCase, and constants in UPPERCASE, I am able to quickly identify what the variable I am looking at is. It also allows me to make a visual connection to the variables and what they represent in the code. I do think that it is annoying to work with as first though, since I needed to consciously decided how to name the variable, however as I got more familiar with Javascript and Typescript, it started to become more of a habit. Overall, I think that having coding standards really only brings benefits (other than it being annoying at first), so I do think that coding standards should be something that you need to follow when you code. Also, if you really don’t want to deal with coding standards, there are a lot of tools out there that automatically format your code to a specific coding standard for you. For example, I use the “prettier” extension in VScode to point out and correct any mistakes I have in my coding standards.