Reproducing Errors

A physicist, a mechanic, and a programmer were in a car driving over a steep alpine pass when the brakes failed...

Reproducing Errors

One of the most important–and often most difficult–steps in debugging is to reliably reproduce the error.

If you skip this step, you'll never know for sure whether you actually fixed the problem.  The program may work for awhile, but there's a good chance the error will come back.  You're also more likely to be treating the symptoms of the error, rather than fixing the root cause.

Of course, there is a time and place for everything...

A physicist, a mechanic, and a programmer were in a car driving over a steep alpine pass when the brakes failed. The car was getting faster and faster, they were struggling to get round the corners and once or twice only the feeble guard rail saved them from crashing down the side of the mountain. They were sure they were all going to die, when suddenly they spotted an escape lane. They pulled into the escape lane, and came safely to a halt.

The physicist said, "We need to model the friction in the brake pads and the resultant temperature rise to see if we can work out why they failed."

The mechanic said, "I think I've got a few wrenches in the back. I'll take a look and see if I can work out what's wrong."

The programmer said, "Why don't we get going again and see if it's reproducible?"

(Adapted from unijokes.com; origin unknown)

Image by pasja1000 from Pixabay

All original code samples by Mike Wolfe are licensed under CC BY 4.0