If you're a developer, you're going to spend more time debugging than writing new features.
No one really tells you that at the start.
And while Stack Overflow is great for error messages, no one teaches you how to think when things break.
This is the process I wish I had from day one.
🧩 Step 1: Reproduce — and Reduce
Don’t just fix. Reproduce the bug on purpose.
Then reduce the scope:
- Strip away the noise
- Comment things out
- Ask: what's the smallest possible version of this that still breaks?
If you can't reproduce it reliably, you're not ready to fix it.
đź§ Step 2: Get Clear on the expected behavior
Ask yourself:
“What should happen here?”
You’d be surprised how often confusion comes from not having a clear picture of what the code is supposed to do in the first place.
Write it down. Say it out loud. Get your assumptions on the table.
🛠️ Step 3: Check the layers
Most bugs fall into one of these zones:
- UI / state management
- API calls / network layer
- Business logic / validation
- Data layer / storage
- Environment / config
Move through each layer methodically. Add logs, not panic.
🧪 Step 4: Add breakpoints or logs — but with purpose
Don’t spam console.log
like a firehose.
Instead:
- Print only what helps you confirm or eliminate a theory
- Log both the inputs and outputs of suspicious functions
- Use consistent labels (
[DEBUG]
,[STEP 3]
, etc.)
Think like a detective, not a gambler.
🤝 Step 5: Say it out loud (even if you’re solo)
Explaining a bug — even to a rubber duck — often reveals the mistake.
You’ll catch yourself saying things like:
“So this value should be
false
here… wait, unless…”
Your brain listens differently when your mouth talks.
đź§Ľ Step 6: Clean up your assumptions
Some of the worst bugs I’ve debugged weren’t code problems — they were me thinking I already knew how the system worked.
Don’t trust:
- That the API returns what the docs say
- That the config file was picked up
- That your local changes are deployed
Trust evidence.
🚑 Step 7: Patch the bug — and fix the cause
There’s the fix… and then there’s the preventative fix.
- Was this a missing test?
- Was the function doing too much?
- Was the code unclear?
You’re already in the context. Clean it up now so Future You doesn't have to.
🧠Bonus: When you’re really stuck…
Here’s my emergency kit:
- Switch branches or revert and rebuild
- Ask a teammate to look at it fresh
- Take a walk — seriously
- Assume nothing is working unless you’ve verified it
Remember: debugging is a process of elimination, not instant revelation.
Final thought
Debugging isn’t a sign of failure.
It’s a skill. A mindset. A sign you’re deep in the real work.
The best developers I know aren’t the ones who avoid bugs — they’re the ones who can calmly trace them in chaos.
This process won’t make debugging painless.
But it’ll make you dangerous with a stack trace.
✍️ I write about developer tools, communication, and building without burnout.
Follow me on Twitter for more real-world dev wisdom.
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.