Debugging technique: Five whys
Originally developed at Toyota, five whys is a simple tool to figure out the root cause of an issue.
Amazon and other software companies use this for debugging software. I like it because it is simple, and that simplicity makes it helpful with getting unstuck. So if you’re unsure where to begin or what to try next, give it a go.
Here is an example:
The mobile app crashed.
- Why did the app crash? - Because of an unhandled exception.
- Why was the exception unhandled? - Because the code doesn’t have a condition to handle it.
- Why doesn’t the code have a condition to handle it? - Because it was introduced in a recent OS version.
- Why wasn’t the code updated before the OS version update? - Because there is no process to monitor API updates.
You’ll notice this example only took 4 iterations. You don’t always need 5, and sometimes you need more. Even though it’s called Five Whys, it’s not a hard rule, but an iterative technique.