Debugging
Mon Aug 3 2009Every so often I get a call from the boy around 7am. It usually goes something like this:
“Dad?”
“Yes? What’s up sweetie?”
“I’m having a problem with a game I’m writing. The tank isn’t turning around after it gets hit. See here’s what I’m doing…”
And he’ll spend the next five minutes describing step by step what the sprite in his Scratch program is doing. The first time he did this, I tried to listen carefully and ask questions as he described his program. That was hard, not just because Scratch is a visual programming language, but because 7am is pretty early in the morning for me.
But just as he was telling me each step of his program, he said, “Oh! I see what I did. I need to back away from the wall first. Thanks, Dad. Bye.” And he hung up.
It seems that the boy picked up one of the most important debugging techniques on his own: explain your code to someone else. The error will usually show itself pretty quickly.
Now when he calls, I just listen enough to say, “Uh huh,” and wait until he says, “Oh! I see! Bye!”