A Matter of Perspective

February 26, 2018

One of the most frustrating things about coding is that it only takes one { to break everything.

Put this { in any random file, and there is a good chance that it will screw everything up. An extra > in an xml file. Recently I had to deal with blank spaces causing havoc.

It’s pretty maddening. Sometimes, you randomly put that extra squiggly due to a typo, etc. Whatever it is, it just breaks everything. Now your code won’t run.

You can dig yourself into a pretty deep hole by not following the most fundamental rule of coding - code a little, test a little. Essentially what this rule is that you must always verify that the code that you wrote is functional and things are working before proceeding any further. So a tiny mistake can be incredibly complicated if you don’t stop yourself and check yourself.

Tangent: I remember a guide on coding a few years back by one of the smartest classmates I know. He emphasized that this verify as you go approach is one of the most fundamental things you can do.

This is very true. In some sense, this could apply to many things in life. Test the waters. Even in the sense of walking. You don’t walk by moving two feet simultaneously. You always proceed with grounding one foot forward before lifting the other one to take another step…

Anyhow, for the longest time I could only see frustration in the fragility of code. Make one mistake, and the whole house will crumble.

But today, I realized the other way of looking at this issue. Every single line of code must be exactly correct. Isn’t there some beauty in this?

In writing, if you screw up the spelling of the word, then the person can still read it. In a building, if you drill a hole in one of the bricks, the building’s not going to crumble. But I feel that the standard for code to run is even higher.

Every line of code must be syntactically correct. Every line of code, if replaced, must reproduce the exact behavior has it has done before, and every single character must adhere to a structured format.

I think there’s a sense of awe in knowing that whatever you’re coding, it has gone through a rigorous vetting process to ensure that every character obeys the rules of the language and conforms to the designed structure.

To top it all off, you know when you see pretty code.