Learning Curves: My Fun Blog

On life. One learning curve at a time on the path to becoming a renaissance man.

Previous Entry Share Next Entry
Debugging for Medical Doctors
What's debugging you ask? When you know there is a bug in your program, you find it by the process of debugging. How do medical doctors do it? And how they may be doing it wrong.

To debug, you:
1. Observe symptoms (a program getting stuck, crashing or giving you wrong results).
2. Locate where the problem is (usually piece of code which causes the mess).
3. Fix it.
All three basic steps can be much more complicated than they sound. You may need to work hard to understand what symptoms you are seeing. You may break your head trying to figure out what's causing them, and you may waste even weeks trying to fix the issue.

Doesn't the process sound familiar to how doctors diagnose to reach a prognosis? They:
1. Look for symptoms, passively or actively (physical examination) trying to observe the patient and question how the patient feels.
2. Perform tests to get a clearer understanding of what the problem may be.
3. Prescribe drugs, a workout, a diet or even surgery, trying to treat the problem and/or its symptoms.
Medical doctors can be perfect and still reach the wrong prognosis, for several reasons.

Outside signs can be misleading and caused by something unrelated, or by several different illnesses.

Patients may not know how something feels, or how to describe it.
"Where is it? The heart? The stomach?"
"How does it feel? Does it scratch? Itch? Burn?"

Many of us humans are not very aware of our bodies and how we feel. Our emotional spectrum may be limited to just "sad" and "happy". Guiding a patient through this discovery process can't be easy, and is not necessarily a part of how medical doctors are trained.

Locating the problem can be a repeat of Observation above, only with more fine-tuned tests, such as a blood test, a biopsy or even *shaking in boots* exploratory surgery.

The results can bring back no new information, be a definite answer, or provide yet more symptoms to add to the puzzle, helping to analyze what the picture looks like.

Fix it!
Fixing illnesses is not always possible even if doctors do find out what they are. It's possible that a cure has not yet been found, or that all you can treat is the symptoms and hope to alleviate the originating issue. If you can't, it may at least be possible to mitigate the pain, or to help the patient reach a better quality of life.

The problem is, debugging doesn't stop there.
A medical doctor will try to treat illnesses by how likely they are, as symptoms can suggest many different answers.

What is the most likely answer by looking at the symptoms? Then, what is the most likely of these to be present in this particular patient, say a 5 years old girl? Does the medical history tell us anything? Has the patient done anything out of the ordinary? What of trends of illnesses in recent history?
Then, is it likely to get a rare rain-forest disease in New york City? (Okay, bad example. Phoenix?)

Prescribe the likely solution, don't over-do it as you worry about side-effects and how the solution will impact the patient, or achieve the opposite goal. Schedule a follow-up examination. If solution fails, proceed to the next one until symptoms abate.

As a doctor friend of mine mentioned, likelihood is not the only part of what's called DD or "Differential Diagnosis". The examiner needs to also take into consideration seriousness and how treatable it is.

Does that sound reasonable?
It does, but what of emergencies? Say the patient reaches the hospital near death. The doctor may need to "fire in all directions" and hope for the best.

I met doctors in my life, and while many of them were very smart, many of them also had no idea what proper debugging looks like. This is best described by a story of what a friend of mine went through.

He described his symptoms to the doctor and the history of what was tried to resolve the symptom before, as no one discovered its cause up to that point. The doctor listened patiently and then prescribed SIX different drugs and said "let's try all of these and see what works."

While this is obviously an extreme case, my friend, an engineer by trade, was shocked. He may not understand medicine, but he understands debugging. That's not it.

Say the symptoms stop, which of the prescribed drugs do you stop?

Another question which pops to mind is:
How do you know if the result was not due to a combination of two of the drugs? Three?

Humans are not easy subjects. As my friend Ryan Russell (BlueBoar) said on twitter, perhaps they need to be taught how to better describe symptoms.

As my friend Inbar Raz mentioned on Facebook, the human body is not a friendly interface to debug. I wouldn't want to have to be the one doing it, but than again, I didn't attend seven years of medical school.

Making sure a doctor knows how to do proper debugging is basic, and more important than most of anything else he or she can be taught. This is what medical school is about, but obviously something gets broken by the time many doctors finish medical school.

Finally, a raging opinion.
There is not much we can do about many doctors being elitist snobs, and honestly, with as many patients as they need to see in a day I don't blame many of them for having this shield around them. The main downside I see is that they can not accept being corrected by the layman patient.

Many of them would rather say a symptom is psychosomatic than admit they are wrong. Do I blame them for this human trait? No. But as someone who will go see a doctor as a patient, I don't have to like it.

Unlike computer code, the human body is where we live. This is one black box we want to be careful with. Doctors are usually responsible, but some just don't know how to do so properly.

My friend described above said it best:
"Doctor, you are an expert. When I have car problems I go to a mechanic and while he sees hundreds of cars like mine--I know my car best--and it is making a sound that wasn't there yesterday. I can tell you it is coming roughly from an area 'here', but that's where my expertise end. I know my body best, and I come to you for help with what I feel."
The computer is engineered, and we know what it is made of (at least in theory). The human body is being reverse engineered, and we still have a long way to go. Medical doctors are technicians--granted, very smart and able technicians--but technicians non-the-less.

Teach doctors proper debugging.

Some medical professionals may find this post offensive. This is not an attack against doctors in general, neither is it about bad doctors existing. Medicine has been here for a long time and taught the world much. And of course, humans are not as helpful as computers, and are much more complicated.
I obviously lack information (to say the least) on how the process really works, but for us technical people "debugging" is what we call it. From my point of view many doctors seem to skim the process or replace it with prescribing drugs.

If any doctor is willing to share more on the process in the comments section below, we'd all appreciate it and I will point to the information here.

Gadi Evron,

Follow me on twitter! http://twitter.com/gadievron

  • 1

Critical Thinking

What you have written about is very accurate and true. But I would extend it to any field in general. What you have described is the basic failure of people not learning critical thinking. It is just more important in the medical field since it could pertain to your ability to continue living well or not.

Re: Critical Thinking

Yes, it really is about thinking. It also is about diversity of education. If all a doctor knows is what the pharmaceutical companies have sponsored then his tool box is mostly empty.

You're saying that the problem with Medicine is that it's Black-Box testing/debugging?
I like it :)

debugging and making correct decisions

I don't actually know if making proper diagnosis (or properly debugging the situation) is really taught to all doctors (or just good ones) but I know that there's a wide area of science associated with the subject. Because doctors actually have to know about the tests (false positives and false negatives) and other things, I suppose some of them are at least familiar with all of that.




Six different drugs?!?

...even if it was all in my head, and I went to the doctor perfectly healthy, I'd probably become sick after that treatment.

Software engineering has an interesting lesson for medical professionals in this regard: all change is regarded (properly) as potential risk, and the way you introduce risks is slowly -- typically as few at a time as possible.

Some doctors treat drugs as solutions without regarding them as potentially adverse change (i.e., the defining standard of risk). If I come to the hospital with pneumonia, you don't treat me with an antibacterial, an anti-retroviral, and an anti-fungal all at the same time. You also don't necessarily treat me with the strongest drugs in each category. If you do, odds are you'll blow out my liver/kidneys/pancreas and I'll be in a lot worse shape.

Doctors can't "svn revert" if they cause damage early in the process, the way engineers do when they commit a bad bug fix. You screw up in the medical profession, your patient could be dead.

In retrospect, I think the post shows the difference between handling technology and handling humans, performing the same action.

Aristotle says "Hello World".

Gosh, philosophy. Aristotle says "Hello World".

I guess the the only criticism I have is that organisms are far more complex than computers, so biological analogies are tricky. Doctors use templates for debugging based on past and shared experience, because they really don't have a chance to know what is really going on. As programmers, we have a fighting chance even though the problem is intractable.

Cheers, Morton

"Another question which pops to mind is:
How do you know if the result was not due to a combination of two of the drugs? Three?"

also, if the patient gets better, how do you know if any of these drugs did it at all? perhaps the body's immune system fixed itself and the drugs did nothing.

"The human body is being reverse engineered, and we still have a long way to go."

funny you say it like this. my friend Will, one of the best reverse engineers i know, has decided to quit the computer industry and go into medical school to become a neural surgeon so that he may reverse engineer the brain.

- Jason

Thats remind me a joke

(That's my bad translation from Hebrew)

A veterinarian was sick and went to see a doctor. While the doctor examine him, He ask the vet about he's symptoms, the pains, etc.

The Vet Became annoyed: "When I treat my patients, I can ask them nothing. I Examine them, give them a treatment, and they recover. Why do I need to answer all those questions?"

"OK", Answer the doctor. "Take this medicine. If you won't fill better in a week, I will put you to sleep".

Meaning: Error-locating method that work best for one discipline, dose not have to work in another.


There is not much we can do about many doctors being elitist snobs, and honestly, with as many patients as they need to see in a day I don't blame many of them for having this shield around them. The main downside I see is that they can not accept being corrected by the layman patient.

If you were trying to debug some software, and I--who barely know anything about coding--was looking over your shoulder and saying, "What about that?" wouldn't it bug you?

In fact, your body lies. There's things such as referred pain, where the pain isn't where the pain source is. There's hidden and masked symptoms. ("Oh, you mean that bruise was important? I thought I just bumped something.") So it often isn't as straight-forward as you think. Medicine really is a lot of trial and error still.

Debugging for Medical Doctors

When i was at medical school a couple of decades ago we were told the
following methodology

1) introduce yourself to the patient - the best docs tend to use their
first name and not their title in a "one human to another human" kinda
2) ask open question like what has been going on
3) listen to patient!
4) proceed to elucidate further information - time lines, associated
symptoms, family history, social history, contact with others, foreign
travel, allergies, etc

known locally as the biconicoid theory of history taking (open to
closed questioning)

5) ask standard barrage of general questions known as systemic review

At this point you should have managed to form a differential diagnosis
with a 95% surety that that your top choice is the correct one

You then proceed to examine the patient looking for signs to prove or
disprove your theory
Once you have your working diagnosis you then order the correct tests
to back up your hypothesis or delineate the severity of the diseases.

Using tests or treatments as a "Hail Mary" is particularly frowned
upon and is seen as 1) exposing patients to unnecessary risk and 2)
bad medical practice by an incompetent doctor.

As A. Conan-Doyle would have told you disease is highly logical and
that if you manage to elicit the correct clues and put them together
then you will achieve the correct diagnosis and the best possible
outcome for your patients.

Therein lies the problem though.

case example:

45 year old patient presents with gastric irritation.
He has previously presented with nasal polyps as a child, asthma as a
teenager and developed a dropped foot 10 years ago which has proven to be resistant to treatment.

His GP and all the consultants that have been treating him for 20 odd
years are unable to think of anything further.

He is referred to a local gastro guy to have an endoscopy.
This consultant does the biopsy of his stomach wall but as he is a
*very* thorough type. He sits down with all the
volumes of this patient's case notes and reads them from cover to
cover. By the time that the biopsy pathology report comes back it
merely confirms his theory that this patient has Churg-Strauss


It is not simply a question of medics knowing about debugging.

The main problem in medicine is that the manual for the human is huge and pride can often get in the way of asking for help
from those doctors with the required "mind the size of a planet"
needed to understand it.

Hear hooves and think horses but if you see stripes and can't tell a
zebu from a zebra then refer. There are no stupid questions, only
stupid mistakes.

A good doctor can work in isolation from *all* technology. We have at home the "pharmaceutical folder" containing the drugs that my Grandfather used in his daily practice as a doctor. It contains the same core drugs that i have used to treat patients 80 years later with only few useful additions.
Retrovirals and anti-cancer drugs being obvious examples of these.

>It does, but what of emergencies?

Even when patients arrive "near death" there are still *very well
researched* protocols for use to identify the cause and correct


And wrt the guy that got 6 treatment from his doctor, please tell him
never to go back to that hack but rather to seek professional help.

>Medical doctors are technicians--granted, very smart and able >technicians--but technicians non-the-less.

You are forgetting though that medicine is the oldest art as well as
the oldest science

Teach them medicine, not EE or CS.
Teach them Art and Science. Teach them to use best practice for which we have good evidence. Teach them all that is currently known about human anatomy, physiology, biochemistry, sociology, psychology. Teach them how to stay on top of the information curve and how to search for information that they need. Teach them about being a physician and a surgeon and a psychiatrist or a pathologist and let them find their own niche. Teach them humility and compassion.
Learn from the mistakes that medicine has made over the centuries wrt

Mike Simpson

  • 1

Log in