A Raisin a Day

Contrary to popular belief, raisins might actually help prevent oral disease.

Reflections on Code

Orac at Respectful Insolence recently posted about how to annoy a surgeon by saying surgeons are just technicians. Much of what he said seemed pretty familiar to me as a programmer, especially this part:

We have a saying in surgery: “You can teach a monkey to operate; you just can’t teach a monkey when to operate or who needs what operation–or what to do if things are not what expected.”

There’s an old programming joke along the same lines. A company’s in crisis, they call in the guy who originally wrote the code but left a year ago, he looks around for fifteen minutes, changes two lines, and then presents a bill for $5K. The manager is outraged at what seems to be an exorbitant rate per line, and demands an itemized invoice. The programmer/consultant provides one:

  • Changing two lines: $50
  • Knowing which two lines to change: $4950

While there are similarities between surgeons and programmers, there are also – obviously – differences. For the purposes of a “just a technician” discussion, here are two that might be less obvious than the difference between writing code and doing stuff inside other people’s bodies.

Happy Birthday to Amy

Yes folks, today is Amy’s first birthday. What a long strange trip it’s been. A year ago, I still didn’t think I was ready to be a daddy. Many people had told me how having children changes your life, but I still didn’t understand. It’s probably impossible to understand, until you’ve experienced it for yourself, what it’s like to see someone who is (in a small way) part of you discover a new thing and take such pure innocent joy in it. It’s almost like being that joyful child yourself – a feeling most of us have lost and should treasure when we are privileged to experience it again.

So, Amelia Rose Darcy, I know you won’t be able to read this for many years, but I just wanted to say thanks. May every birthday make you as happy as you’ve made me.

Trust Me, I Smell Good

Nasal spray makes people more likely to place faith in another person.

Can you bottle trust? The answer, it seems, is yes. Researchers have produced a potion that, when sniffed, makes people more likely to give their cash to someone to look after.

A Swiss-led research team tested their creation on volunteers playing an investment game for real money. When they inhaled the nasal spray, investors were more likely to hand over money to a trustee, knowing that, although they could make a hefty profit, they could also lose everything if the trustee decided not to give any of the money back.

Let me be the first to observe that the researchers shouldn’t have any trouble getting grants to study this further.

Airbags Kill?

A new study (via Science Blog) purports to show that airbags actually increase the risk of death in an accident.

â??NHTSA recorded 238 deaths due to airbags between 1990 and 2002, according to information about these deaths on their Web site,â? said Meyer. â??They all occurred at very low speeds, with injuries that could not have been caused by anything else. But is it reasonable to conclude that airbags cause death only at very low speeds? It seems more likely that they also cause deaths at high speeds, but these are attributed to the crash.

â??For any given crash at high speed, we canâ??t know what would have happened if there had been no airbag; however, statistical models allow us to look at patterns in the data, and compare risks in populations, in a variety of situations.â?

The reason earlier studies have found that airbags save lives is that they used only a special subset of the available data, said Meyer. The Fatality Analysis and Reporting System (FARS) is a high-quality compilation of information about every highway accident for which a death occurred. The Crashworthiness Data System (CDS) is another high-quality dataset, containing random samples of all accidents. The previous studies used FARS, and Meyerâ??s study used CDS.

Before I close, I would be remiss not to quote the most important paragraph – about what this study tells us about seatbelt use (emphasis mine).

While the value of airbags seems dubious in the new study, the value of seatbelts is not. The analysis found that proper use of a seatbelt reduces the odds of death by 67 percent for any given speed category and airbag availability. Airbags, however, cause no statistical difference in car-crash deaths, except for unseatbelted occupants at low speeds, where the odds of death are estimated to be more than four times higher with an airbag than without.

Enlightened Laziness

Just about everyone nowadays is probably familiar with the idea, most notoriously popularized by Ayn Rand, of selfishness as a virtue. Selfishness underlies the drive to compete and excel, the argument goes, and if you don’t allow people to act selfishly then they won’t live up to their potential (economically or otherwise) and we’ll all be worse off. Obviously not all forms of selfishness are condoned, though. Mugging your neighbors is still bad form. The apparent inconsistency is usually explained away by “enlightened self-interest” which takes into account some longer-term effects but still rather conveniently fails to absorb lessons about things like strategy and emergent behaviors…but that’s a topic for some other time. I’m here to talk about laziness right now, and why it could also be considered a virtue. The idea of laziness as a virtue is clearest (to me anyway) from computing, where there are two well-known rules of optimization:

  • Don’t do it.
  • Don’t do it yet.

One of the fun things about this pair of rules is that it’s not clear whether they’re about what the code should do or what the people who write the code should do…but it doesn’t matter because it’s valid either way. If you don’t do something now, you might later find that you don’t need to do it at all and therefore would have been wasting your time anyway. Whether it’s code that doesn’t allocate a resource until the last moment or a programmer who doesn’t write the code until it’s proven necessary, that initial laziness often pays off. You’d be amazed how many problems in a typical programmer’s (or architect’s) life just sail right by without requiring any intervention if you let them; the trick is to recognize which ones actually do require attention. In a broader context, much of industrial engineering and operations research are about enabling laziness. What else do you call it when the explicit goal is to decrease the amount of work necessary to achieve a result? The fact that most people look at it backwards, as the same amount of work producing greater results, doesn’t change the essential fact that efficiency and laziness are so intimately related as to be almost inseparable.

As with selfishness, not all forms of laziness have such beneficial effects. In particular, if the cost of doing something (e.g. fixing a bug) increases over time, then deferring it might be an unwise choice. Hennessy and Patterson actually devised a powerful formula for this which involves the probability that an optimization will be applicable, the benefit when it is, and (most often overlooked) the cost when it isn’t. In the simplest case, if there’s a 50/50 chance that you can skip doing some work and get away with it, the savings each time you guess right had better be more than the cost each time you guess wrong. I guess we’d have to call this enlightened laziness, hence the title.