Archives

February 2010 (1)
September 2009 (1)
May 2009 (1)
April 2009 (1)
March 2009 (4)
January 2009 (3)

November 2008 (2)
October 2008 (2)
September 2008 (1)
August 2008 (5)
July 2008 (3)
June 2008 (1)
May 2008 (5)
April 2008 (8)
March 2008 (3)
February 2008 (1)
January 2008 (2)

December 2007 (2)
November 2007 (4)
October 2007 (17)
September 2007 (9)

The tale of the teddy bear

2007-10-25 21:10:51

Years ago someone told me about the teddy bear, and I have never forgotten. It’s a story I tell people — or the programming subset thereof — and that they in turn pass on.

Imagine a university computer lab, full of students working on their programming assignments. (You can tell this is an old story, because these days no doubt all the students work on their own computers wherever they like). There are only two teaching assistants for the whole lab. They’re pretty busy. At their desk is a large teddy bear.

One of the students gets stuck, goes to the free teaching assistant and says “help! My program won’t compile!”

And the teaching assistant says “I’m happy to help you. But first, you must explain your problem to this teddy bear.”

The student hesitates, then starts to tell the teddy bear “well my code creates a pointer for the beginning of the list, and then …” (Blah blah blah).

And after about 30 seconds of explanation, the student says “oh shit! I know what it is!”, goes back to their console, and fixes their own problem.

Which is why my number one debugging strategy for intractable problems is to find someone else to explain it to. Not because I expect them to solve my problem for me, but because telling a coherent story about the problem, with all the information needed to explain it to someone else, helps you understand it yourself. And strategy number two, if I can’t find someone else to talk to, is to write things down as though I were sending a detailed bug report to someone else.

Tags: debugging ~ programming




Rendered at 2010-08-01 22:16:38