Is Code a Uniform, Is Code an Expression of Self

23 Sep 2021

Coding standards… some indentation here, braces over there, etcetera

There are some widely followed coding standards, such as indenting lines of code that are inside of a loop. In general, these are stylistic, in order to help improve the code’s readability. At the same time, there are variations depending on the programmer’s personal preference. For example, exactly how big to make the indents, whether or not to vertically align a pair of curly braces, and what (if any) spaces to put around certain punctuation markings. In general, these coding standards don’t make a difference to a computer reading the code, but they might make a difference to a person reading the code.

You can become used to a certain routine

As coding standards are currently, a lot of variations exist, so there is no formal standard. In my experience, this is the culture in online coding examples as well as in classroom settings. Therefore, I feel that my peers and I have each become used to our own personal style of coding.

Coding standards and learning a programming language

I feel like the experience of experimenting with code on your own and having fun with it is a big part of learning a programming language, in terms of effectiveness as well as motivation. Furthermore, I feel like finding the style of coding that you like the best – that feels most comfortable, seems the most attractive, and makes the most sense to you – is part of that experimentation and fun. In other words, I do feel like finding your own style can help in your learning.

Coding as a collaborative effort

However, coding often involves projects where more than one person is working on the same program files. Programmers might also be working on personal projects on their own, but during that process, they might ask peers to review their code if there’s a bug or other problem they can’t solve, or they might refer to peers’ projects and code (such as GitHub repositories) for ideas. In other words, the world of programming regularly and sometimes heavily involves people reading and working with (trying to understand) other people’s code.

Reading someone else’s code can be difficult and even frustrating if their style of coding is different from yours. You’ll read slower and work slower, and you’ll be stressed by all of this on top of the stress from working out the project objective itself. In that case, maybe having a formal coding standard would be beneficial. Even if it’s different from what many people use, the end result will be that everyone will only need to expect one type of style that’s different from theirs, rather than ten different styles from all ten individual team members, for example.

ESLint’s coding standard

Recently, I’ve been using ESLint while writing javascript programs on IntelliJ. ESLint involves a very specific coding standard. This coding standard is different from my own style in multiple ways. For example, I like to use a bigger indent than ESLint does, and I like to vertically align both ends of my curly braces, but ESLint does not. It’s been a bit frustrating for me because I find ESLint’s coding standard to be quite difficult to read and quite unattractive. It doesn’t make sense to me.

The fact that I’ve been required to use ESLint for several class assignments has been a bit inconvenient, but one feature on IntelliJ has made it much easier to deal with, thankfully. Anytime there’s an ESLint error, I can ask IntelliJ to “fix” the file I’m working on. Immediately, IntelliJ reformats the syntax of my code to match ESLint’s coding standard. Therefore, I don’t have to reprogram my brain or try to teach myself how to write code in a whole different style than what I like; rather, I can just write how I like, and then I press the “make ESLint happy” button, and I get the green check mark approval symbol on my program’s file! It’s glorious! It does mean that the code is a bit difficult for me to read over afterward, but I can manage. It’s not too much different from reading someone else’s code online or in group work for school.