Writing Understandable Code

10 Feb 2022

Previous experiences with coding standards

I have some prior experience with coding standards from my previous ISC courses. In my ICS 212 course that I took last semester, we had semi strict coding styles that required us to add four spaces to indent code and to never use the tab key for it. We also had to add comment boxes above every source file and above each of the function it had containing things like the function name, parameters, and return values. This was quite a pain to follow since the main software that we were using was pretty old. Most things were done manually, no help was given by the editor to check for style and even syntactic errors.

Coding standards rock

Even before going into this module, I was all about learning coding standards and improving it. I totally agree that this is a technique that a software engineer should learn to improve the quality of their code. Unless I’m planning on writing code just for myself, there is no reason not to follow a certain style. It would make collaborating with other programmers a lot easier since there will be less stress trying to understand code that someone else wrote. Having said what I said, even if writing code just for myself, it would be beneficial for me to have coding standards with things like catching errors and preventing error in the first place. When we think of programming language as like a spoken language, I like to think of coding standard as the tone and the attitude of your voice. Code that follows the style makes the listener easier to understand your point and makes the listener want to listen to what you are saying. On the other hand, code that violates makes it harder to listen to and can seem as your are being disrespectful.

After using ESlint for a week

It has been about a week and I feel that ESlint is a great tool not just to write good code but to learn it. I thought that the way ESlint notifies errors and tells us how to solve it was extremely helpful. One biggest error that ESlint taught me to fix was using “let” when I should/could be using “const” as a variable declaration. Small things like this should be fixed early on so that it won’t cause harm when we start working on bigger projects. The red error markers can be tedious sometimes especially when during the WODs but the pleasure it gives when I finally get the green check mark is indescribable. It also makes me feel confident that my code is error free when I turn it in not that I still do double, triple, quadruple check it.