Saturday, January 9, 2010

Optimizing the Common Case

For some reason I realized yesterday that my behavior of wearing shorts and sneakers all year (in New England, even in winter, and yes even when shoveling snow) is a manifestation of optimizing for the common case.

At some level I knew this, but never quite drew the parallel with writing code.

I, like most people, spend most of my time indoors or between places in a warm car. My dress is therefore optimized to comfort indoors. In fact, in the winter, indoors is usually kept warmer than it is in the summer (not at our house, especially before my daughter came along).

Shoveling the snow in sneakers isn't a problem. I'm always *behind* the shovel after all. I rarely actually have to step in snow above my ankle.

The few minutes I'm generally in the cold just doesn't seem worth optimizing while being too warm the rest of the time.

And it always struck me funny on days where it snowed that people would spend the day tromping around the office space in their boots. All because of half an hour in the morning (likely walking in already shoveled/plowed areas from their car to the door at work).

Of course, conditions can get cold enough, such as with wind in January. But those are outlier cases certainly.

When coding, optimizing for the common case is important to keep in mind. As well as not optimizing too early (before you really know what needs optimizing) of course.

Sitting in my shorts in the winter while coding will now hopefully serve as a reminder of that! At least until I smarten up and move somewhere warmer someday...

No comments:

Post a Comment