Neo: What are you trying to tell me? That I can catch all my bugs in testing?
Morpheus: No, Neo. I'm trying to tell you that when you're ready, you won't have to.
TLDR: You already know how to do it; no heroics required; go for low hanging fruit; start now.
Typically when I mention the idea of No Bugs to people, they respond with doubt and disbelief. They think I'm nuts, or they think I'm defining "bug" in a very narrow way, or that it could only be possible in some very specific context (no schedule pressure, a simple problem domain, greenfield development, etc.).
What is a bug?
The definition of bug I am using is very broad: anything that disappoints or surprises anyone.
The only people that use narrow definitions of bugs are the people who have lots of bugs. This is a coping technique that is unnecessary when you have no bugs.
If I wrote my code correctly, but something I depend on broke and now my site is down, is that a bug? Yes.
If the developer implemented code according to spec, but the spec was wrong, is that a bug? Of course it is.
I don't care about categorizing bugs. It's just bugs.
If you ever ask "does X count as a bug", the answer should be "yes".
When is a bug?
Are we only talking about bugs that customers see? What if it's caught during testing?
I measure "bug injection" when the change is checked in to source control. When it escapes the developer's machine. In GitHub it would be when a pull request is merged in to master. I like this definition because it lets me lean on unit tests, static analysis, lint, etc. in an automated CI system.
Arlo wishes he could measure even earlier - if it gets typed in to the editor, it counts as a bug. More on that later...
What is zero?
At the AONW session Arlo asked the room how many bugs people currently have open in their bug tracking system. Answers looked like:
Then he asked Brian Geihsler about a project he was on. The answer had a very different shape:
- 3 days to 3 weeks between bugs
(They also measured # of stories delivered between bugs.)
And then he asked Chris Lucian:
- 12-18 months between bugs
Changing the rules
Are these zero? My inner mathematician says no, but my inner project manager says yes. If you can measure days between bugs, that changes the rules:
- You no longer need to get the most expensive people in a room to triage bugs.
- You never need to argue about whether something is a bug.
- You never need to choose between fixing a bug and writing a feature.
- You can ship whenever you want.
How is this possible?
It's not about testing. It's about addressing the causes of bugs.
Where do bugs come from?
Bugs happen when a human makes an incorrect decision.
The human brain is really good at making decisions, and doesn't let a lack of information get in the way. Even worse, it doesn't tell you that it's making a decision based on a lack of information. It just makes the decision and feels confident about it. Worse still, you have a limited short term memory, so even if the information you need is available to you, it may not all fit, but you won't know it.
Here are some ways that code can set you up to make bad decisions:
- A variable is named "taxReturn" when it represents a "tax refund" (code that lies)
- A variable is named "txRfnd" when it represents a "tax refund" (abbrs. obfuscate)
- Two variables representing the same idea are named differently (unnecessary synonym)
- One idea is expressed in more than one place
- A function that is very long
- Whitespace/indentation doesn't match the parse tree (Python wins here!)
Some examples out of code:
- A dependency broke (add automated checking that the dependency still works)
- I wrote a feature the customer doesn't want (pair with a customer)
How to get to zero bugs?
This is my favorite take-away from the AONW session: there's no secret. You already know how to get there.
You already know how to get a little better. Rename a variable. Automate a step in your release process. Pair program on a kata for an hour. You can probably think of a dozen small improvements that you could make right now.
Each time there's a bug, look for some way you can avoid that class of issue. Pick the low-hanging fruit. The easiest, quickest, safest change that you know you can execute and get benefit from right away. Don't be ambitious. Do pick something that has been trouble recently.
Do it again. Keep iterating.
How long will it take?
Assume it will take about 2 years to get to Zero Bugs.
That means you need to progress 1% towards your goal each week. I know you know how to get 1% better right now.
It's a choice.
Now that you know how to stop writing bugs, the responsibility rests on your shoulders. If you're still writing bugs 2 years from now, it's because you decided to keep writing bugs.