Jake Worth

Jake Worth

Make a Prediction

Published: June 08, 2022 2 min read

  • debugging

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

Everything you try leads to another unexpected result.

You can’t predict what’s going to happen next.

I have a technique that’s going to help:

  • Think of an action you might take
  • Predict what’s going to happen when you take that action
  • Take the action
  • Check if you were right or wrong, consider that information, and repeat

Here’s how it works.

Making a Prediction

Imagine you’re debugging a webpage, and you’re trying to understand why some data on your page is wrong.

Think of an action you might take to learn more. You might be wondering, how is the data bad? To find out, you decide to print it.


Before looking at your console, stop! I want you to make a prediction about what’s going to happen next.

What do you predict the data is going to look like? 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 hard. Speak your prediction out loud.

Now, take that action and look at the console. Were you right or wrong? There is no partial credit.

Considering this information, think about the next action you might take. Log something else? Use a debugger experiment with your object? Jump to a different part of the code?


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 application responds this way… why?” You’re reacting. You’ll eventually type Shakespeare, but it will take a while and you won’t learn much.

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 taking a stand.

Predicting moves you from “it’s not working” to “I expected items to be an array of data, but it’s undefined.” That’s actionable information.

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 in my workflow that turns off my autopilot when something unusual happens.

Make a prediction.

Get better at programming by learning with me. Subscribe to my newsletter for weekly ideas, creations, and curated resources from across the world of programming. Join me today!