Jake Worth

Jake Worth

Make a Prediction

Published: June 08, 2022 • Updated: May 17, 2023 2 min read

  • debugging

Imagine you’re debugging, and you’re stuck.

Everything you try leads to another unexpected result.

You continue to be surprised by what you’re seeing onscreen.

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? Think, and say your prediction out loud.

Now, look at the console. What do you see? Were you right or wrong? It’s binary and there is 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, the does this… but why? It shouldn’t do that!” You’re reacting. You’ll eventually stumble onto the 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 pretty useless, to “I expected data to be an object, but it’s undefined,” which is very useful. It’s specific enough to be actionable, or at least lead to a good next question.

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.

What are your thoughts on predictions? Let me know!


Join 100+ engineers who subscribe for advice, commentary, and technical deep-dives into the world of software.