The Rules that Make One’s Code Readable

22 Sep 2021

Before I knew about Coding Conventions

When I was a freshman in college, I took my first coding class. It was a beginner class where we learned about C. We learned about variables, for loops, while loops, if-statements, functions, and many other types of operations, however, we did not go over coding conventions or have any type of coding standard. For this reason, I found it hard to help others within the class in finding the bug within their code. Everyone had a different way of formatting their code as well as little to no commenting. Their code was very hard to read and understand which made trying to comprehend their code take quite a lot of time. I’m sure that my code was very unreadable as well since it did not follow any particular coding principle either. At the end of the semester, we had a final project where we worked in groups, which made the readability of everyone’s code even more important. Our group met many times to explain our code to each other to make sure we were all on the same page and knew how everyone’s code worked. In the end, our project went well, however, it definitely would have gone smoother if there was a coding standard in place. When I took ICS 111, I started to use the Eclipse IDE where our class implemented its own coding standard that every student had to follow. It was through this class that I realized that there were coding conventions that programmers followed as a way to make their code more legible.

Coding Standards Help Us Learn the Language

Through having a coding standard when I was learning Java, it not only helped me to format my code readably but also to program efficiently. Some errors that were given had to do with having a variable I never ended up using, unnecessary else statements, and assigning variables a value that did not match its data type. These errors aided me in learning from these mistakes and not repeating them as I progressed. It also made me think more about why not having an else statement in certain cases still works and is more efficient. Through the constant repetition of seeing certain errors popped up, I got better at dealing with them. As a result, I felt more confident to programming in that language when hardly any errors came up. Coding conventions also helped me when I was learning a new language. When learning python for the first time, I would put a semicolon at the end of each line, however, unlike C or Java, it does not use a semicolon to denote the end of the line. In this case, the coding standard flagged that error and helped me get used to the syntactical difference between the languages. Through all the assistance coding standards provide, it is my best friend when I program.

ESLint with IntelliJ

In my third year of college, I started to learn how to program in JavaScript and used the IntelliJ IDE and ESLint as the coding standard. I personally liked the coding convention of ESLint; it was similar to other coding standards I had to follow before. Some features of ESLint that I appreciated was to use single quotes for strings instead of double quotes, and to have an extra new line at the end of the source code. ESLint also provided many explanations to the errors that occurred and how to fix them. One of my personal favorite points of ESLint was the green check mark at the top when all coding standards are followed. It was not only useful but also satisfying to see that everything was correct.