Two things I’m learning recently – a programming language and a new swimming stroke – combined the other day, and the result is (among other things) this blog post. What can you learn from coders that helps you learn?
Debugging: a methodical pessimism in action
The process of finding out why a computer program crashes is known as debugging. You might have known that, but you might not have cared. After all, we usually expect the apps and programs around us to run smoothly.
Programmers don’t. In fact, one of the most useful things I heard the other day during an introductory programming course was this: “experienced programmers don’t expect their programs to run perfectly any more.”
This kind of pessimism informs debugging, giving the search for errors a strangely exciting persistence – if you can get ten lines of code to work well, then you move on to trying to fix the mistakes brought about by lines 10-20. Or if you want to start finding the mistake in a bajillion lines of code, you may choose to divide it down the middle, decide which half the problem is hiding in, and keep dividing until you see where the problem is. You can read more about those methods if you wish, it’s fascinating stuff
Debugging my swimming
I’m learning freestyle. My breaststroke is good, automatic, relaxing, and enjoyable. My freestyle, to begin with, was a chaotic flailstorm of sputtering sinkability.
I was ready to give up, but I also started learning to code again at the same time, and took the debugging lesson.
My next time at the swimming pool, when it was time for freestyle, I used a pullbuoy to hold my legs up. Now I didn’t need to worry about my kicking. My arms still sucked, but at least I didn’t drown.
A few swims later, my arms knew what they were doing (thanks to countless YouTube sessions and some good internet searches). They started to work. I was still confused about breathing, though.
The next few sessions are about breathing and arm movement…and so on, and so on.
I didn’t hire a teacher to do this. Instead, I decided to worry about one half of the problem (upper body), and then isolated the problems there (how to move arms and how to breathe). When my arms and my breath are ready to bring me more speed than drowning, I’m going to start joining them with the kicking.
Debugging is good for learning – so why teach to expect perfection?
If you are told you need to do really well, you will be to scared of mistakes (bugs) to look at them. Definitely you won’t want to do them again. But sometimes that is what a debugger needs – to reproduce the mistake!
If you get penalized for errors (at school, at college, at work), you will try to organize your life so that they don’t happen. The opposite approach, if you can afford it, can actually be better for you – no matter what you learn.
Burn a few more cakes, bake a few more bricks instead of bread. Think about which part of the recipe let you down.
Speak a few more sentences of atrocious Spanish to others. Think about what exactly brings about the bemused look on their faces.
Try a few more Excel formulas with your practice spreadsheet. Search the web for what you’re doing, and what you’re getting. See who else fixed it before you.
Good coders don’t expect their code to work perfectly.
Don’t hold out such high hopes for life, either. Debug it as they would!
Hi - thanks for reading this. All three of my eBooks will now cost you less than a fiver, and come with a 45-day guarantee. Get the bundle here.