Clean Code For the Soul

25 Sep 2019

Coding standards are something that I can compare with maintaining a vehicle. It’s one of the things that seem completely negligible at first, but will eventually start to creep up on you, and will strike at the worst and most inconvenient moment, and will hit with full force. You won’t realize how important these small things are until you are faced with a situation that is equivalent to being stranded on the freeway in the rain with a blown out engine. Thinking that you should have changed your oil and followed the maintenence schedule while you wait for a tow is way too late to start thinking about routine maintenence. The same can be said for establishing coding standards, as it is much too late to think about having coding/formatting standards when you are a few thousand lines of code deep into your final project. Having set coding standards will keep things neat and organized, and will definitely take some load off of the madness when you’re occupied with debugging a program. Having a standardized style is easier for everyone involved, as everyone is held to the same standard. Having the same coding standard as your peers will make it easier for you to ask for help, as it will be easier to see the actual logic of the program, and we don’t have to decipher any personal style. You’ll eventually be conditioned to notice anything that looks out of place almost immediately, which might either be a good thing or a bad thing, depending on how formatting affects you.

Incorporating ES Lint honestly wasn’t really much of a learning process for me, as initial setup seemed like it had a “set it and forget it” kind of feel to it. All I need to do is to make sure it is enabled in the settings of the editor that I use to write code in, and include a configuration file with my code, and the rest is easy-peasy-lemon-squeezy. Whenever my code doesn’t conform to the standard, errors appear, and hovering over the error with the mouse pointer lets you know what is wrong, and provides the relevant documentation instead of just having a red squiggly line that just tells you that your program is angry at you. Also, there is a red icon in the upper right hand corner of the code editor that lets you know that you still have errors to correct. Once all errors are corrected, the red X icon will be replaced with a green checkmark that lets you know that all is well.

The green checkmark seems like an achievement of itself when you clean up all the ES Lint errors that appear as you write your code. When you first start with ES Lint, it seems like it’ll make the time to write code much more longer as you need to take care of all of your ES Lint errors that appear, but picks up real quick once you get used to the standards that you are held to. To me, having clean code also feels kind of catharthic in a way, as everything looks like it is in the right “place”, and the green checkamrk gives you an internal peace that can only be matched by having your code compile and run correctly with no errors, plugging in a USB cable the right way on your first try, or the first sip of a beer after a long day. It almost feels like a certain zen state has been achieved, and that everything is right in the world when no ES Lint errors are encountered. Although this may not be the case, as cleaning up all the ES Lint errors is just a small portion of whatever large-scale project you may be doing, it is one of the few indicators that can provide positive feedback, and gives the feeling that everything will be okay.

In the span of a week, it feels like my time with some of these practice WODs during the week have substantially decreased, and I can say that I feel very comfortable with writing code that adheres to the standards of ES Lint. Incorporing the established coding standards along with ES Lint feels like I am presented with a blank canvas, that is already some kind of masterpiece of itself, and conveys the message of elegance through simplicity, uniformity, and organization. I’m looking forward to honing my code even further, and using ES Lint to achieve that gives me confidence that my code will be as clean as possible.