Saturday, November 18, 2023

Learn to Test

I used to think it was silly when shows had futuristic computers narrate what they were doing. 

You know, those little stream-of-consciousness declarations, like “scanning the area for life forms” or “initiating self-destruct sequence”? They seemed like cheap writing trying show the audience that things were happening.

Now that I have more programming experience, it makes more sense.

My early coding efforts — in Twine, so we aren’t even talking about something complicated — were nightmares of frustration filled with obscure error messages and opaque syntax warnings. Early versions of the SugarCube documentation didn’t make a lot of sense to me, and it was slow going trying to sift through Q&A pages for answers.1

It was easier to loiter in the Interactive Fiction Community Forum, where I found Linus Åkesson2 sharing a useful metaphor about building bridges. It's okay to start with something feeble, because you can build on it through a gradual process of refinement and evolution. 

As I beat various projects into shape — leaning on the bridge metaphor and applying McDonald’s Theory — I learned the four possible states in which code exists:

My coding efforts are still full of errors and janky syntax, but now it’s easier to find and fix the problems. If my projects need less development time, it’s not because I’m faster at coding. It’s because I’m faster at identifying where things failed. I have become better at testing. 

These improvements came from using more comments in the code and indicators that explain what's going on. When it's easier to see where things are failing, it's easier to identify where you should fix them. 

In that context, it makes more sense to have the computer announce that it’s scanning for lifeforms or initiating a self-destruct sequence.

1. I should note that is much more user friendly in the present day.
2. You may recognize his name from the “8-bit Baroque Metal” performance that recently took certain corners of the internet by storm.3
3. That wasn’t an intentional pun, but it works. SORRY I’M NOT SORRY.

No comments:

Post a Comment