Understanding The Standards to Write Understandable Code

20 Sep 2018

What is Coding Standards?

Coding standards is the formatting or style that programmers follow when writing their code. The standards vary with different languages and workplaces. These standards are usually kept consistent in order to enforce a guideline. The concept of a coding guideline seems simple, but it yields great importance. With coding standards, it allows peers and other developers to follow code without difficulty, since it is formatted in a way that they are familiar with. If the user is familiar with the coding standards, he or she can spot errors more quickly, since code that does not follow the standards will stand out prominently. Some people may consider it a hassle to get used to, but it will greatly increase the efficiency of getting work done.

Importance of Coding Standards

Coding standards play a role in the quality of code. A properly formatted program and a messy program could have the exact same functionality, but the code that is neat and readable would be considered better quality. Note-taking is an analogous example that mirrors the importance of proper formatting or standards. There is an obvious difference between notes taken with an organized bullet point system and messily scrawled phrases that is not organized in any sort of way. It is people who produce neat and organized notes that are considered to have “good note-taking” skills. Messy notes may be legible to the person who wrote the notes, but undecipherable to peers. For example, if a student is unable to attend a lecture, he or she can ask to look at a fellow classmate’s notes. However, if the notes contain sentences that are haphazardly jumbled together along seemingly nonsensical drawings, the student will be unable to understand it. The same goes for programming. If there is an error in the code which you cannot find, you could ask a peer to review it. The format of the code has to be readable. If it is incoherent, it may as well be a foreign language to the peer. Thus, it is important to use coding standards, so other people who look at your code or intend to use your code can understand it.

Learning with Coding Standards and My Experience

ESLint’s enforcement of coding standards can help ICS students develop good coding habits. ESLint immediately informs the user if something does not follow the coding standards. This allows the student to continually fix their code and adhere to the coding standards. It will eventually become natural for them to always format their code in accordance to the standards.

My initial impression after the first week of using ESLint with IntelliJ is overwhelmingly positive. It is very advantageous that ESLint immediately underlines code that is not following the coding standards. It can potentially highlight errors that I would normally miss without ESLint. I find the green checkmark on the upper right corner to be very useful. I find no frustration when it is a red x, since it conveys that there are errors in my code. It will be more frustrating without ESLint, since I would have to manually find the errors.

All in all, coding standards plays a vital role to habituate students into writing neat and organized code. ESLint assists in that by enforcing the format and informing the user when there is code that does not follow the coding standards.