Skip to the content.

A computer is a machine for following instructions.

This is both the best and the worst thing about computers.

You can tell them to do anything and they will work tirelessly with machine-like speed and precision.

On the other hand, they have no common-sense nor self-preservational instincts. A computer won’t say to itself, “Hmm…I wonder if she really meant that?” It will just go merrily on until it crashes into some unintended side-effect of your instructions.

And there will always be unintended side effects. Think of all the stories about being careful what you wish for. If you leave a loophole, the magic will use it to twist your wish and give you something you didn’t want. Computers are like that. Not through malice, but through sheer mindless devotion.

And it turns out that writing water-tight instructions is hard. So hard, in fact, that the best way to do it involves a lot of trial and error. At least it does on computers, where it’s cheap to run lots of instructions and (usually) safe from major consequences.

So computer programming is learned almost entirely through failure. This does not mean you are bad at it! This is the fastest way to get where you want to go.

I’m hoping to help you avoid some of the most common pitfalls very early. And you’ll eventually accumulate enough experience to anticipate the ones that come up most often in your area of expertise. But there are always more pitfalls lying in wait.

So your programs are always going to have bugs. There is no such thing as bug-free software. You have to find a way to allow yourself to be OK with that, and accept that bugs are a natural part of the process and not a reflection on you.

I often think that the main thing about people who enjoy programming as an end in itself is that they love to poke and pry, twist and prod at things until they figure out how they work. To us a bug can be an invitation to play, to experiment, until we’ve learned something new about this pattern of instructions and the interesting things it can do when you make little changes to it. At least it could be when we were kids with unlimited spare time…as adults, of course, we’re often just trying to get work done and we swear at the bugs like everyone else.