An old, nowadays almost forgotten programming language, Visual Basic, features an mechanism called “On Error Resume Next”: if you add this instruction to your code, it will instruct the program to continue its execution, no matter what happened. You accidentally do a division by zero? No problem, just continue. You write outside of a buffer? Oh well, maybe it works next time. As an experienced programmer, I nowadays joke about this feature, and occasionally bring it up as a possible solution when I join a bug-fixing task force at work.
Now, joking about the silliness of this expression aside, I remember how frequently I used it when I started learning programming. Back then, in middle school, I didn’t learn programming because I was interested in machine code or how CPUs work. I wanted to program cool games, that are fun to play, and impress my classmates! I didn’t care how the code look, as long as I got some awesome looking results quickly. Having to learn a programming language was a necessity to achieve this goal, but not necessarily fun by itself.
Reflecting about my attitude back then got me thinking that this is exactly the problem many people face when they want to learn programming. The frustration about code not running because of inexplicable error messages causes large portions of interested students to give up. Nowadays, I try to write super efficient, thread-safe fail-safe code, with rollback mechanisms and apply every pattern I’ve learned about reliable code – writing perfect code. That is not what you want to achieve as a newcomer. As a starter in the world of programming, you need satisfying moments. Improving your code quality comes later.
The things that burned into my mind from my first programming steps were not about efficient code, but seeing the machine doing what I wanted it to do: the first time the screen turned black when the DirectX 2D engine took over and bit-blitted a paint-drawn bitmap all over the screen was exciting. The first time OpenGL rendered a rotating teapot was. Getting some music playing out of the speakers was. Struggling over copied-together code from tutorials was not.
The thing is that, as a fresh starter, you usually have no understanding of computer science at all. To get an understanding on how a computer works, one of the most important steps every programmer novice has to overcome is to understand the fundamental differences between human communication, and communication to a machine. If you talk to a human, and forget a few words, or put the words in the wrong order, chances are high that your counterpart is still able to guess what you meant. This ability is fundamental in human communication, and we rely on it everyday. A computer doesn’t do that, and learning this logical strictness of a programming language is both frustrating and challenging.
“On Error resume next” was a big help for me to get started with programming, and a powerful ally in fighting the strict logic of a computer. How did my first steps look like back them? I connected the modem to the phone line, dialed into CompuServe, and looked up some Visual Basic forums for tutorials. After downloading them quickly, I had to disconnect the modem to avoid getting scolded for blocking the phone line. I then spend several hours trying to get these tutorials running, and modifying them. In most cases, this didn’t work out of the box. The program crashed due to an integer overflow – how was I supposed to understand that? I noted it down on the things to look up the next time I would go online, and added an “On Error Resume Next” instruction. With a engulfing feeling of satisfaction, I watched my game running stable now.