From Crash Carts to Keyboard

Debugging Is Just Differential Diagnosis

3 min read

The diagnostic framework I used in the ER maps almost perfectly to tracking down bugs in code. Here's how clinical thinking makes you a better developer.

The first time a senior developer told me to "isolate the variable," I almost laughed. I'd been doing that for years — just with blood pressure cuffs instead of breakpoints.

In emergency medicine, differential diagnosis is the core skill. A patient presents with symptoms. You form hypotheses. You run tests to narrow the possibilities. You eliminate until you find the cause. It's methodical, it's iterative, and it requires you to hold multiple possibilities in your head at once.

Sound familiar?

The Framework

Here's how clinical reasoning maps to debugging:

Chief Complaint = Bug Report. The patient says their chest hurts. The user says the button doesn't work. In both cases, the stated problem is a starting point, not a diagnosis. You have to dig deeper.

History of Present Illness = Reproduction Steps. When did it start? What were you doing? Has this happened before? The questions are almost identical. The goal is the same: build a timeline and find the trigger.

Physical Exam = Reading the Logs. You observe. You measure. You look for signs that confirm or rule out your hypotheses. In the ER, that's vitals and auscultation. In code, that's console output and stack traces.

Lab Work = Writing Tests. Sometimes you need to provoke a specific response to confirm what's wrong. You write a test that targets your hypothesis. If it fails in the way you expected, you're getting closer.

Treatment = The Fix. And just like in medicine, you don't just treat the symptom. You treat the underlying cause, or it comes back.

Where It Gets Interesting

The real parallel isn't in the steps — it's in the mindset. Good clinicians resist anchoring bias: the tendency to lock onto the first plausible diagnosis and ignore contradicting evidence. Good debuggers do the same. The bug isn't always where you think it is.

In the ER, I learned to ask: "What's the worst thing this could be?" Not because I was pessimistic, but because ruling out the dangerous possibilities first is good practice. In code, I've adapted that to: "What's the most expensive thing this could break?" Check the critical paths first.

The Advantage Nobody Talks About

Career changers from healthcare have a diagnostic toolkit that most junior developers haven't built yet. We're trained to work systematically under pressure, to document what we find, and to communicate our reasoning clearly.

The next time you're stuck on a bug, try thinking like a clinician. Take a history. Examine the evidence. Test your hypotheses one at a time. And don't anchor on the first thing that looks suspicious.

The patient — I mean, the code — will thank you.