Coding with style

08 Feb 2018

Coding style is an important component to programming and communication. A standard coding style is not only readable to others, but especially to yourself. If your code style is awful, then trying to debug your own code is a nightmare. In my experience of starting out programming, it was so hard to look through my own code, which led to hours of trying find simple bugs. Overtime, I learned to standardize my coding style to make things easier to read and see, and it’s like a night and day difference. Now if your new, then thankfully, Javascript has ESlint. My coding style is fine, but using ESlint is a definite choice to newcomers, or terrible code writers, as ESlint teaches the most important thing about coding style and that’s SPACES.

Initially, when you start coding you tend to space things randomly because you just want to get it done since you’re probably impatience in this early stage, I sure was. It’s true that randomly spacing things is faster, but the problem with just randomly spacing things, it is ten times harder to read the scope of your functions as well as the whole code itself. Specific spacings are important to the programming language and random spaces could drastically affect your program. This will cost you time to fix and it is a lot longer to fix things then to do it right the first time. Using ESlint eliminates these habits by training you to standardize spacing everything.

ESlint will get mad if you don’t follow its rules by giving you this irritating red warning. That red warning, to me, is very irritating as certain spaces I feel are unnecessary such as having a new line at the bottom of the whole code. For newcomers this red warning is good because it tells what’s ugly with the coding style and should be fixed. Once fixed there appears this nice green check mark saying the code is beautiful and elegent, not really, but it looks very standardize and that’s what you want. For people reading who figured out to standardize their code, then ESlint does really offer anything. For newcomers or people with code that’s too hard to read, then try out ESlint and start coding with style.