Shifting my weight and making myself comfortable while watching the playful glimmers of light shining in through the window pane of the large lecture hall, I can hear the AC blowing gently from the back. The professor is in the middle of his lesson, pointing at different code examples on the pull down projector screen, before something he says makes its way to my ears. “In the beginning, when you’re coding, you’ll find that there seems to be a structure to it, a certain amount of spaces to indent here, a new line here, and while it may seem very rigid now, I promise you, you’ll get the hang of it soon.”
Out of all the things my EE 160: Programming for Engineers Professor said that day, that was the one sentence that played over and over again. He’s right. I did notice the similarities between all the code examples he put up on the screen. There seemed to be a repeating pattern emerging from the slides. While he didn’t mention how many spaces are needed, on exams and during labs, I knew when to approximately indent here or start a new line there. But the one thing I had trouble on for the longest time was the parentheses for the if…else statements.
It came natural to me to want to close the if…else statement line with a bracket at the end. On some level, it even bothered when the line wasn’t closed with a bracket. I mean, why waste a whole line for a bracket? Plus, you could even keep track of whether you closed it or not in the same line (this was before I found out that if you just clicked on the bracket, it would tell you where its counterpart was).
Since then, after several more programming classes, I’ve come to learn that knowing and adhering to coding standards helps in readability. It’s highly important in the computer science field, where heavy collaboration is everywhere, for someone to be able to read your code. When you make it easy for someone else to help you with figuring out what went wrong with your code, the easier it’ll be to find a solution to it. Tools like ESLint make it easier than ever to make sure your code is adhering to coding standards, heck it’ll even fix it for you!