My father, who never wrote a line of code, taught me everything I ever needed to know about debugging when I was a teenager. It went something like this:
Me: Dad, my car won’t start.
Dad: Does the engine not crank, or not fire?
Me: It doesn’t crank at all. It’s probably the battery. I can go get a new one.
Dad: Before buying a battery, check the battery voltage.
I think, “I’ll do it because he says so, but I could just go buy a battery and be done with this.” But I don’t say that.
Me: The battery shows 12 volts. It’s probably the starter. The auto parts store has starters in stock.
Dad: Before buying a starter, connect jumper cables to the battery, connect the negative side of the cable to the negative post on the starter, and briefly touch the positive cable to the positive post on the starter to see if it cranks.
I think, “Oh, man. He’s making this take so long! I can just put a new starter in and finish up.” But I don’t say that.
Me: It cranks. I bet it’s the start solenoid.
Dad: Before buying a start solenoid, disconnect the battery, clean the corrosion from the posts and terminals, and reconnect the battery.
I think, “What a pain in the neck! I can replace the start solenoid in 10 minutes.” But I don’t say that.
I clean the battery terminals, as instructed, and the car starts. Dad just gives me a look.
I think, “Huh. That wasn’t so bad. I’m sure glad I didn’t waste my time and money replacing the battery, the starter, and the solenoid when I only needed to clean the battery terminals.” I should have said that.
A few years later, in a college computer room, a classmate asked me to help him debug a misbehaving program he’d written. He began by telling me what wasn’t working. The rest went something like this:
Him: Maybe I should rewrite the calculation module.
Me: Before you rewrite the code, have you checked how you initialized the variables?
I suddenly realized I was using the seemingly slow, disciplined approach to troubleshooting my father had taught me … without ever acknowledging that he was teaching.
My father passed on April 6, 1993. I’m still learning how I benefit by unknowingly emulating him from time to time. I have a friend who acknowledges similar realizations. When it happens, he says we occasionally find ourselves wearing our parents’ clothes.
He’s right. And they’re such a perfect, comfortable fit.