A Practical Taxonomy of Bugs and How to Catch Them
Biologists use taxonomy to categorize living things, including bugs, which are not fundamentally different from programming bugs. Programming bugs and living bugs both have attributes and behaviors. Phenetics is a branch of classification that groups organisms by their observable attributes. In this talk I’ll describe some common types of programming bugs: Heisenbugs, Mandelbugs, Bohrbugs, Schroedinbugs, Hindenbugs, etc. For example:
Let’s look at the Bohrbug. The Bohrbug is named after the Bohr atom model because it consistently manifests under consistent and well-defined conditions.
The Bohrbug itself will be illustrated as a Bohr model of a stable atom with six little legs. Then I’ll classify each of those bugs by their observable attributes and behaviors. For example:
Are you observing this bug in production? (yes) Can you reproduce the bug easily in your local environment? (yes).
If so, you might have a Bohrbug on your hands. Bohrbugs are deterministic (meaning they always provide the same output for a given input) and are characterized by their repeatability and reliable manifestation. Bohrbugs are often found as GitHub issues with many +1s or reported to your developer twitter account for projects of sufficient popularity.
Once I’ve built a taxonomy of common bugs, I’ll step through a workflow built from my own experiences and those I’ve collected for resolving each bug. For example:
The Bohrbug is the friendliest of bugs and the easiest to catch. We’ll catch it first because it will provide a model for each of the other bugs:
- Replicate the Bohrbug manually on your machine.
- Write a test that mimics the replication process you just did manually. Assert that the correct thing (and not the Bohrbug) is taking place in the environment that the bug lives in.
- Bag the bug by writing the simplest possible implementation.
- Rewrite your implementation so that it is highly readable. Readable code prevents bugs from sneaking back into your code base when someone else had to make changes.
The resolution steps for the Bohrbug might seem contrived but they lay the groundwork for the more complex resolution steps for other types of bugs. Next, let’s look at a more complex example that is a variation on the Bohrbug
… After identifying, classifying and showing resolution tools and process for each type of bug I’ll review the idea of “narrowing the universe” that a bug lives in.