Watching a senior engineer debug looks like intuition, but it's almost always a repeatable process underneath — one you can learn directly instead of waiting years to absorb it by osmosis.
Reproduce it first, always
A bug you can't reliably reproduce is a bug you can't confidently fix — you might change something that looks related and just get lucky, without understanding why. Before touching any code, find the smallest, most reliable set of steps that triggers the problem every time.
Read the actual error, slowly
It's tempting to skim an error message and jump straight to guessing. Stack traces tell you exactly which line failed and the path that got there — reading it fully, starting from the top line (not just the bottom), often points directly at the cause without any guessing required.
Bisect instead of guessing
When you don't know where a bug lives in a large piece of code, don't scan it line by line hoping something jumps out. Add a print statement (or breakpoint) roughly halfway through the suspect code path, confirm whether the bug appears before or after that point, then repeat in the half that's still broken. This cuts the search space in half every time, and finds almost any bug in a handful of steps.
Change one thing at a time
Changing three things at once to "see if it helps" is how bugs get fixed by accident and reintroduced later, because you never actually learn which change mattered. Make one change, re-test, and only move on once you understand why that specific change did or didn't help.
Question your assumptions, not just your code
A huge share of debugging time is lost because of an assumption that feels too obvious to check — "that value can't possibly be null here," "this function is definitely being called." Actually verifying these assumptions, rather than trusting them, resolves a surprising number of "impossible" bugs in minutes.
Most debugging time isn't spent fixing the bug. It's spent finding the one wrong assumption that made the bug invisible.
Write the regression test before you forget why
Once you understand the bug, write a test that fails without your fix and passes with it, before moving on. This isn't busywork — it's what prevents the exact same bug from quietly coming back in six months.
The takeaway
Reproduce reliably, read the full error, bisect instead of scanning, change one variable at a time, and question assumptions directly instead of trusting them. It's a process, not a talent — and it gets faster with deliberate practice.
Keep reading
Related articles
How to Learn React in 30 Days (A Realistic Roadmap)
A day-by-day plan that takes you from JavaScript basics to building and deploying your first real React app.
JavaScript Fundamentals You Can't Skip
The core JavaScript concepts that unlock every framework — explained with tiny, runnable examples.
Git Without the Fear: A Practical Mental Model
Stop memorising commands. Understand what Git actually does and the day-to-day workflow clicks into place.
Discussion
Leave a comment
Your email stays private and is never published.