The Only Rules You Need To Follow

10 Feb 2022

Making life easier

Imagine reading an essay with uneven spacing, no indentations, no line breaks between paragraphs, and odd capitalization that made it difficult to read. One technique that solved this problem was the MLA coding standards. If you have ever had to write a report in school then you probably remember this standard: 12 times new roman font, double spaced, indentations for new paragraphs and the list goes on. Just as an essay is made up of organized and structured words that allow us to tell a story, code is also just organized words but in a way so that it tells a system what to do and when to do it. Therefore, programmers created a coding standard, one of which is called ESLint. ESLint is a code quality/style analysis tool that is used to identify problematic patterns found specifically in JavaScript code. As a computer engineering student, this was the first time that I was introduced to a coding standard. Heck, some of the coding tests from engineering professors even had a lack of basic coding standards such as function indentations, odd spacing, and unused variables, but as long as it worked, your code was good. However, when taking these tests I would always in a way use a simple coding standard (“gg=G”) through vim which would reindent a whole file making looking through the program so much easier to work with.

Red = Bad

For my ICS 314 course, I paired IntelliJ IDEA along with ESLint for a better understanding of how to adopt a better coding standard. This meant that I could code in IntelliJ and have ESLint running in the background to check my coding grammar and structure. During the first week of using ESLint I had so many errors, these errors came in the form of a red squiggly line along with a red exclamation mark with the corresponding number of errors. To be honest, my first piece of code that I wrote with ESLint had about 40 errors; incorrect variable declaration, wrong use of quotes, incorrect spacing, etc… However, after using ESLint for a week, these common mistakes weren’t too hard to fix and relearn. Relearning and incorporating ESLints coding standards helped me write code that was easier to read and reduced the complexity of my code massively.

Do it for others

I recently had an interview with a software engineering company with an interest in machine learning. Throughout this interview, one thing that really stuck with the interviewer was the fact that I brought up the importance of adopting a coding standard so that collaboration with others, and the project’s production rate can be as seamless and efficient as possible. As a company, your code is usually modularized into many different sections, which need to be combined at the end. However, the friction in project production comes when some sections have awful coding standards, and everyone needs to stop to figure out what the hell that team’s code means. Therefore, big companies issue a coding standard which is used as a guideline to encourage programmers to write code that makes it easier for others to read and follow along with. Coding standards give collaborators a way to all stay in sync with each other, and progress as a team when approaching problems. This additionally leads to being able to tackle a problem with multiple heads, and eventually to team learning. After using a coding standard for a while you learn about the quality of code rather than quantity, and that being able to write elegant and intuitive code is by far better than a bunch of unorganized and unstructured words on a screen.

~