Make a Prediction
- 3 minutes read - 429 wordsImagine you’re debugging, and you’re stuck. I have a technique that’s going to help. Think of an action you might take. Predict what will happen when you take that action. Take the action. Check if you were right or wrong, consider that information, and repeat.
This may sound simple, but it’s incredibly powerful. Here’s how it works.
Making a Prediction
Imagine you’re debugging a web application, and you’re trying to understand why some data on your page looks wrong.
Think of an action you might take to learn more. Maybe you decide to log your data to see what’s wrong with it.
console.log(data)
Before looking at your console to read the data, stop! I want you to predict what’s going to happen next.
Is it going to be undefined
? Is it going to be an object with some keys, but
not the right ones? Is it going to be an object with the right keys, but the
wrong values? Say your prediction out loud.
Now, look at the console. What do you see? Were you right or wrong? You made a precise prediction, so it’s binary. There’s no partial credit.
Considering this result, think about the another action you might take. Log something else? Use a debugger? Log something higher up?
Repeat.
Reactive to Proactive
This is a powerful technique, because it forces you to pivot from reactive to proactive.
When you’re debugging, it’s easy to be reactive. “I do this, then I see this… but why? That shouldn’t be happening!” You’re reacting. You might eventually stumble onto a solution, but it will take a while and you won’t learn anything.
We want to be proactive. There’s a saying about debugging: “if all you’re assumptions were correct, you wouldn’t be stuck.” In other words, your mental model is broken. To have a chance at fixing a bug smartly, you must at least have a mental model. That’s what making a prediction does. You’re making a model. You’re taking a stand.
Predicting moves you from “why isn’t it working?”, which is useless, to “I expected an object of data, but it’s undefined,” which is very useful. It’s specific enough to be actionable, or at least lead to a good next question. Such as “why is this object undefined?”
Predicting Anytime
I make predictions all the time when coding. On my best days, it puts me in a state where I’m making prediction after prediction and seeing them realized. When they aren’t realized, it’s jarring. It’s like a trigger that turns off my autopilot when something surprising happens.
Make a prediction.