Grammar for Programming Languages

22 Sep 2016

Introduction

A programming language is essentially a language that is used to communicate instructions to a computer. There are many programming languages, but like other human languages, there is never a mention of using proper grammar. The grammar in programming languages comes in the form of coding standards. A person can know how to speak a certain language, but if they don’t use proper grammar, it may be hard to understand them. The same purpose of grammar in human languages, also applies to programming languages. People who know the person who wrote the code and their style of coding may be able to understand the code, but it can be difficult for other people to understand. The readability of code becomes even more important when working collaboratively on a software project because the project needs to be readable by everyone working on it. Coding standards ensure that these large software projects will have uniform formatting. If you’re interested in coding standards, check out this article by David Mytton.

My experiences with ESLint and IntelliJ

This past week, I began using ESLint along with IntelliJ for all of my programming. ESLint is a linting tool for JavaScript and ItelliJ is an IDE that supports JavaScript. My overall impression is that having a tool to check my syntax is extremely useful. Before I used ESLint and IntelliJ, I was using an online code editor called JSFiddle. A problem that I often ran into with JSFiddle was that I would get errors, but I did not know exactly what line of code contained the error. JSFiddle is great for small programming activities, but once the size of code grows, an IDE becomes more important.

Coding like a newbie

Not following a coding standard made my code look messy and my inexperience with JavaScript really showed. After using ESLint and IntelliJ, I was able to improve the formatting of my code. A great thing about ESLint is that it does not only check for errors that will prevent the program from running. It also checks if variables are used and if they are defined using the correct identifiers. I often make the mistake of using const instead of let and vice versa when defining variables. ESLint actually helped me to burn into my mind the correct uses of const and let so I’ll never make the same mistake again. Small things like this add up and eventually my code becomes better formatted and easier to understand.