Critical Path Newsletter

The snow shoveling theory of software development

Shoveling 30cm of snow off your driveway in -15C/5F weather isn’t a whole lot of fun. But it does give a guy time to think.

So a couple of weeks ago, when I was clearing my driveway, my mind wandered to a piece of advice a software architect had once given me.

 

Most people shovel their snow right next to the driveway after the first snowfall, doing as little work as possible, and continue to pile the snow on top of it. By mid-winter, they have a two meter/six foot snowbank and face either lifting the snow above their heads to add it to an ever-growing pile or throwing it over the pile.

Piling the snow farther away from your driveway at the beginning of the winter takes a little more planning and a little more work—and it pays off in a month or two, when you start piling the snow at the edge of your driveway, proving you’re the smartest guy in your neighbourhood.

 


Then, my mind wandered even further… How could I apply this technique to software development? Fueled by endorphins and super-cooled by the temperature, my brain started to whirr, mashing up the architect’s advice and Jean-Yves’ pay it forward blog posts.

I came up with a simple rule, which I call “The Snow Shoveling Theory of Software Development.”

 

If you spend time planning and work a little harder in the first phases, you will achieve better quality, have less rework, and your applications will be easier to maintain.

 


Note: This doesn’t mean going back to the waterfall process and spending six months writing a spec—just don’t think it’s agile to start coding without knowing where you’re going.

I decided to let my idea percolate while I did more research. Was what the architect said true? Did most people do poor snow removal planning?

I hopped in my car and drove around the neighbourhood (after I finished my own driveway, of course).

Some folks contracted out their snow removal (We’ve always said you should outsource non-core competencies. Very efficient!). Others owned a snow blower (We’re also big fans of automating repetitive tasks). A small minority shoveled farther onto their lawns first.

Most people didn’t. Most people took the short-sighted view, doing the least possible amount of work in the short term and made a big pile right next to the drive at the beginning of the winter. Maybe 75% of people who shoveled by hand.

I put a quick, non-scientific poll on our wiki intranet to see what percentage of Macadamians had already implemented the SnowShoveling class.

Sixteen people responded. Five of those gloated that they didn’t have a driveway or lived in a place where it hadn’t snowed that day. Three more had outsourced their snow shoveling needs. The remaining eight broke down like this:

 

 

 

I made a three foot high snow bank right
next to my driveway
2
I shoveled it three feet away from my driveway 6

Seems most Macadamians already recognize the value of Snow Shoveling Theory.

Let’s take a look at a high level implementation:

 

 

class SnowShoveling
{
const int MIN_THRESHOLD; /* Minimum amount of snow
that makes this worthwhile.*/

  const int PROBABILITY_ THRESHOLD; /* Minimum chance
  of future snow that makes this worthwhile.*/

 

 

  SnowShoveling();

shovelSnow()
{
if(getHeightOfSnowOnDriveWay() < MIN_THRESHOLD)
{
// Don’t bother, the snow bank will be
// small
pushSnowOffDriveway();
}
else if (getFutureSnowStormProbability()
< PROBABILITY_ THRESHOLD)
{
// Winter is almost over, no need to plan ahead. Push
// it off your driveway and let it melt there
pushSnowOffDriveway();
}
else
{
// A significant amount of snow, and probably more
// coming. Plan where you can put the snow to have
// room for future snow.
Location snowLocation = getSnowRemovalDestination();

// Get your shovel and move the snow.
sleighSnowTo(snowLocation);
}
}
}

 

 


In this algorithm, there are at least two factors affecting whether planning ahead is useful.

First, how much snow has accumulated. For example, if you’re adding a minor feature, it’ll only take a week to implement. Maybe you’re building a prototype. For small projects, over thinking is probably not worth it. There’s no point spending a week planning for a week-long implementation—it’s more efficient to do a day or two of rework.

Then, there is the probability of more snow. For example, for an application almost at the end of its life and adding one last feature before a new release. There is probably not much gain to plan for future features. There probably won’t be any.

Alternatively, for version 1.0 of an application, you need that code to stick around. It’s good to think about the possibilities for extending and maintaining the application. Get your shovel and plan ahead.

 

 

shovel.gifSome things to think about for version 1.0 Do these as you go, and the cost will be low. Wait until the end, and you might have a snowbank problem.

Logging
You’re building a service that will run all the time. How will you debug it when something goes wrong in the field?

If you think you need logging, plan it before you start coding. Make sure each patch contains the code to log information, warnings and errors you might need for troubleshooting.

If you leave it out, you’ll have to go back to look at every function to identify and add the required logging. For a large project, this might take weeks, and critical errors will most likely be missed.

Localization If you define your localization framework from the start, hard coding a string or getting it from the string table will take about the same amount of time. If you don’t, going back to replace all the strings will take longer. Even worse, you might have to convert your code from Ascii to Unicode.

Other common scenarios

 

 

    • Using forward references—Jean-Yves’ suggestion.
    • Defining clear interfaces between components.
    • Commenting your code.

 

 

You’re probably thinking this is nothing new. But the truth is some people have shoveled snow for years and still do the minimum amount of work when the first snowfall comes.

At least it’s good for the snow removal firm they call in February when there’s no place left to put the snow.

For information on how Macadamian can help get that pesky snow out of your driveway, email software@macadamian.com.

 

 

macadamian
Contact Us: 1-877-779-6336 or Email Us