RSS
 

Archive for the ‘coding’ Category

How Unit Testing Could Have Saved Lives

16 Jan

A recent article in The Independent describes a fascinating study.  Researchers found that forcing surgeons in a London hospital to implement a single new procedure caused the death rate after surgery to fall 47 percent.  Complications likewise fell by 36 percent.

These are enormous numbers:

Donald Berwick, the president of the US Institute for Healthcare Improvement, said of the innovation: “I cannot recall a clinical care innovation in the past 30 years that has shown results of [this] magnitude.”

The change?  The surgeons were required to run through a simple checklist before and after every procedure.

Now, this checklist [pdf] is not lengthy.  In fact, it’s less than twenty questions.  Even more strikingly, the questions are not complicated: before administering anesthesia, has the patient confirmed his identity?  Does the patient have any known allergies?  Have we confirmed that this is the right foot?  I’d wager that the most common reaction of people seeing this checklist is “you mean these things weren’t being asked already?”

The thing is, these questions were already being asked.  The difference is that they weren’t being asked in systematic way.  Members of a surgical team assume that these obvious things have been checked because they’re so obvious.  “Of course this is the right patient.”  “Of course we asked if he’s allergic to the anesthetic.”  “Of course we marked the right limb for amputation.”

The problem is, these things are sometimes done incorrectly, or missed entirely.  Not often, not usually; just sometimes.  Forcing doctors and nurses to use the checklist caught these “sometimes” problems, and dramatically improved patient safety in the process.

From this study, we can draw the following conclusions:

  1. Even obvious errors are easy to commit, and once committed, can have terrible consequences.
  2. Those who overlook these problems can be highly-trained and intelligent people.  It appears that you cannot out-train or out-brain our human tendency to err from time to time.
  3. Instituting a rigorous system to check for errors lowers their occurrence dramatically, compared to existing processes that check for them informally.

Laid out this way, these statements are probably starting to look familiar, because they are exactly like the arguments for using unit tests in programming.  As a software developer, I look at this list and think we knew this stuff already!  We knew it, and we came up with a way of mitigating the problems caused by our own flawed humanity.

The errors that this checklist catches are the kind that kill people.  Thousands of people, every year.  If we, as an industry, had somehow conveyed the efficacy of systemic testing with the medical field, this checklist might have been implemented sooner, and lives could have been saved.

The fact that ideas like this don’t flow across fields is not surprising.  Industry-specific myopia reflects our human tendency to form into groups and distrust outsiders.  Despite this, I do believe it’s worth struggling against.  Perhaps the field of architecture could provide useful insights into the construction of software (perhaps it already has).  Maybe the next big idea in architecture will be inpsired by chemistry, or biology.  Maybe the next time I open my editor I should think “first, do no harm.”

It certainly couldn’t hurt.

 
4 Comments

Posted in coding

 

Damn Useful: When You Forget to type Sudo

09 Dec

(This post is part of a series.  To read more tips and to learn about the philosophy behind these posts, check out the parent post.)

You know you’ve done this way too many times:

ben@lispclub ~ $ apt-get install blahblahblah
E: Could not open lock file /var/lib/dpkg/lock – open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Bah.

You forgot to type sudo first.

So what do you do?  Hit up arrow, swing back to the beginning of the line, type sudo–ARGGH…THE WASTED SECONDS!

Do this instead: sudo !!

In bash, !! means “repeat the last command I entered.”  Bash substitutes your apt-get command after the sudo, and you finally get to install blahblahblah 0.0.13.  Note that this isn’t specific to sudo.  If you do an ls, and then wish you’d grepped the results for foo, type !! | grep foo.

How to remember it:

Imagine an angry father yelling for his son.  “Sudo!!”  Sudo runs down from his room, sees the command  he was supposed to be in front of, and executes it immediately.

 
16 Comments

Posted in coding

 

Damn Useful Tips

09 Dec

This post is the first in a series called Damn Useful.  The posts will be a number of tips on the tools we use most frequently as programmers, particularly the shell and editor.  Because of my own preferences, I’ll focus on bash, vim, and unix tools like grep, screen, and others.

Here are some guidelines on what to expect:

1. One tip per post.

I’m a sucker for productivity tips.  I’ve read dozens of articles with titles like “25 _____ Tips for Fun and Profit!”  I usually take away at most one useful tidbit from these articles.  A lot of good stuff gets lost in the tidal wave of new information.  This posts in this series will be short: one tip each.  I’ll focus on just one idea and move on.

2. I’ll provide mnemonics or imagery to aid recall.

Can you name the nine planets in our solar system?  How about the order of arithmetic operations?

If you can, I bet you access a mnemonic you’ve learned for this purpose.  I use My Video Eye May Just Show Us Nine Planets, and Please Excuse My Dear Aunt Sally for these two.

I’m never, EVER going to forget the names of the planets.  That mnemonic is in my brain for good.  I want the things you learn through this series to be the same way.  As such, I’ll try hard to come up with memorable mnemonics for them.  Sometimes mnemonics don’t make sense, and I’ll instead provide an image to think about that will hopefully stick in your mind.

3. The tips will involve tools programmers tend to use daily.

The value of a tip is proportional the number of times a day you can use it.  These tips will probably only be worth a few seconds each on their own, so I want to be sure there’s a big fat multiplier next to each one.  I’ll be focusing on the heavy hitters in the programming world.

The Posts:

When You Forget to type Sudo

 
No Comments

Posted in coding