No matter what programming language is being used, code should be properly formatted in such a way that is easy to read. Doing so makes both the coding process and troubleshooting so much easier. At a minimum, one should exercise principles such as consistent indentation, naming schemes, and line length. I have had experiences in the past where I became frustrated troubleshooting a peer’s code because there was no consistency in formatting and zero regard for readability. What does this variable ‘u’ do? Why is there no proper indentation for these nested statements? What scope am I in? There was one time I told my friend to format their code or else I won’t bother looking at it because it actually gave me a headache.
I try my best when it comes to properly formatting code. I exercise proper naming schemes like camelCase. I use consistent indentation. I group related lines of code into blocks. Easy to read code is important to me because I often need to troubleshoot multiple lines of my program. Rarely does my code work on the first try. However, sometimes I am pressed for time and need to work fast. This is often the case when working on WODs (Workout of the Day) for my ICS 314 class. Because these WODs are timed my brain sometimes forgets to do certain things. There are so many times where my code failed to work due to simple errors like forgetting semi-colons, curly braces, parenthesis, return statements, and typos. Fixing these simple mistakes costs time and has cost me from completing WODs in the past. Situations like these are why I have found coding standards such as ESLint very helpful.
Since using ESLint, it has made my life so much easier! It practically reminds me of every simple mistake I make when coding, which happens to be a lot. I no longer have to search for that missing curly brace that sends my code into error. I no longer forget to add a return statement and scratch my head wondering why my function return is undefined. I actually did that in a WOD once and did not finish as a result. Some people may find coding standards to be a pain but to me they are very useful. Getting that green checkmark is so satisfying to me because it gives me confidence that my code will work. The majority of the time my code fails is due to simple typing errors and ESlint prevents that by notifying me of them beforehand. In my opinion, coding standards make learning a programming language much easier because it gets makes your code easier to understand and saves you frustration from troubleshooting making the overall experience more enjoyable.