Theories are Time-Consuming

On Friday I reminded you that if you are really trying to understand why your code is misbehaving, then you should be actively trying to disprove your own theories. This is a time-consuming operation. Theories take time to test and prove or disprove. Therefore, you should try to limit the number of theories you form.

That is to say, focus first on where your code is misbehaving before you try to answer why.

Remember that we defined a bug as "when observed behavior in your application differs from expected behavior". Given known starting conditions, you should be able to walk through your code and describe what you expect to see at each step. Once you trace through your code and find the spot where reality diverges from expectation, then you're most of the way home. Oftentimes once you reach this point, the answer is staring you right in the face.

It's a simple idea, but difficult to execute effectively. That's what we'll work on this week.

More tomorrow.

Next Up:
Can You Articulate the Bug?

Previously:
Debugging is Uncomfortable


Want to impress your boss?

Useful articles delivered to your inbox. Learn to to think about software development like a professional.

Icon