Software design lessons from real life

Since moving to the bay area and starting work in San Francisco, I’ve been doing much more city walking than I ever used to. On my way from the BART station to work, I have to cross two streets. As a computer programmer (and as Distracto!), I’ve been thinking about which is the most efficient way to get there. Allow me to demonstrate with this map (xx is a crosswalk):

---------+--+----------------
         |  |    Market St.
---------+--+----------------
         |  |
[BART]   xxxx - A
         |  |
         |  |
         | -+---- New Montgomery St.
         |  |
         |  |
     B - xxxx   D
         |  |  /
-------x-+--+-x--------------
       x |  | x  Mission St.
-------x-+--+-x--------------
      /  |  |
     C   xxxx - E
         |  |
         |  |
         |  |
         |  |  [Work]
         |  |

Now, I could cross at A, and if the walk sign is on, it might seem like a good idea. But the time taken at A might cause me to miss D, forcing me to wait another full cycle. And for my particular case, it’s a much longer wait to cross Mission than New Montgomery.

It’s possible that if I had not crossed at A, I might have caught the tail end of the light at C, and then could immediately cross at E. And if I missed C, I could still cross at B and I’m no worse off than I was before. So now I never cross at A. I’m convinced it saves me a ton of time.

And the software design lesson? Don’t optimize prematurely. Wait until you know what your biggest bottleneck is, and work around that first. Okay, maybe it’s a strech, but these are the things that I think about on my way to work.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Reddit
2 comments

2 Comments so far

  1. gever April 11th, 2005 5:47 pm

    I walk the same route, and have adopted the same pattern you are using, but did not draw the same parallel with programming. I have, however, added a late-binding optimization (maybe its more of a lambda) wherein I jaywalk anywhere between A and B that the traffic allows. Since New Montgomery is one-way, it’s often safe to cross and I am able to apply my optimization about 50% of the time.

  2. Kyle Bennett May 9th, 2005 11:13 pm

    Wow, you mean there’s another person who sees programming analogies in everything? I spend my smoking breaks staring at the anthill out in the parking lot. I thought I was the only crazy one. BTW, I have a pony tail and rarely shave, and no-one sits next to me on the bus or train.

Leave a reply