Do Programmers Optimize... Life?

Back in university, a friend who was studying arts and I were talking and at one point I said something like "I see every situation as a problem requiring optimization", which elicited the response "How... sad".

Now I was probably no more than 19 at the time. By that stage I'd been programming for nearly 10 years, having started out on a Commodire VIC 20 (and yes I'm still bitter we didn't get a Commodore 64) then graduating several years later to the dizzy heights of an IBM PC-XT (complete with CGA graphics). That eventually got me onto Turbo Pascal, which marked a turning point.

That being said, even until the end of high school, it actually hadn't occurred to me that being a computer programmer was even a job, let alone that I should be one. I wasn't fast-tracking or jump-starting myself into a career. I just liked doing it and it had basically replaced that childhood stalwart of Lego. The two I think actually have a lot in common except programming is a far more tractable medium.

As it happened, I went to university not to become a programmer. In fact, I wasn't sure what I wanted to do yet. I just felt like I should go or even that it was expected (i was the first to go in my father's line). Interestingly, I had always had far more natural ability with mathematics.

During this period, a lot of what I now consider to be key indicators for a programmer-to-be were there: game-playing, basically. All sorts of games: computer games, card games, role-playing games. It borders on being a cliché. All of this relates to an affinity for problem solving, a penchant for analytical and rational thinking and an ability to conceptualize abstractions—all key abilities and qualities of a programmer.

This of course raises the age-old chicken-and-egg question of: do people become programmers because they have the right mindset or do they develop that mindset as a consequence of becoming computer programmers?

The truth, as always, probably lies somewhere in the middle (yes there is something between 1 and 0). It should be noted that people don't just magically have an analytical mindset. In spite of whatever natural predilections someone might have, a disciplined mind is something that is developed.

The question I'm getting to is: how much of this changes the way your mind operates? Learning analytical and problem solving skills for programming is one thing, But what about everyday life?

Let me give you an example.

Sometimes I'll walk home from work. This is a fairly long walk at about 5.8km (3.6mi). Pretty precise distance right? It probably won't surprise you to know I measured it with a GPS. Now like most reasonably modern cities, the layout is largely grid-based. The path to my house is not a direct line by road or walkway although it's pretty close. But I am "off" several blocks.

So immediately we have two problems:

  1. There are a number of different paths going a combination of horizontally and vertically with the requirement that at some point a given number of horizontal moves need to be made (assuming the longer distance is vertical in this relative frame of reference; and
  2. Any diagonal shortcuts are big potential time-savers as they, unlike any horizontal or vertical moves, can reduce the total distance needed to travel.

But it gets more complicated than that. Every road that needs to be crossed can be avoided (by changing route or using an overpass or underpass), crossed at a set of traffic lights or crossed where there are no lights. The traffic lights are significant because they will have timed pedestrian crossings. These may take longer to come up but are guaranteed to come up within a certain time period. With no lights on a particularly busy street you might be waiting awhile.

Sound familiar? In algorithmic terms, we have the classic (and common) choice between a deterministic and a probabilistic solution. So we can profile our street crossings:

Overpass/Underpass Traffic Lights No Traffic Lights
Best Case 0 seconds 0 seconds 0 seconds
Expected Case 0 seconds 60 seconds1 Varies2
Worst Case 0 seconds 150 seconds3 Varies2
1. Based on (3) and the possibility of an early crossing if traffic is sufficiently light
2. Each example needs to be considered independently and can vary by weather, whether it's school holidays or not, time of day and other factors
3. Based on experience of average cycle length of relevant traffic lights.

But wait, there's more! Pedestrian congestion needs to be considered. That bridge over Wellington St might be a convenient way to avoid a busy road and be out of the rain but it also has an awful lot of people on it going (at this time of day) to the train station.

Add to this you may need to vary the route for, say, trips to the supermarket, post office, an ATM, the butcher and so on.

Pretty full on, right?

Now I would imagine that if you're not a programmer—and not in IT altogether—your reaction to above is somewhere between bewilderment and horror. But if you are a programmer I'd say there's a pretty reasonable chance that you're not that surprised.

Before you write me off as suffering form severe OCD, perhaps this will allow you to downgrade it to, well, mild OCD. In this (excellent) movie Spy Game Nathan Muir (Robert Redford) is teaching Tom Bishop (Brad Pitt) spycraft. In a restaurant Muir says:

Muir:
Every building, every room, every situation is a snap shot. I'm sitting here talking to you, I'm also checking the room-memorizing it-the people, what their wearing, then I ask the question-what's wrong with this picture? Anything suspect? You gotta see it, assess it and dismiss it - most of it without looking, without thinking.
Bishop:
Without thinking?
Muir:
It's just like breathing. You breathe don't you?

My point is that the above scenario of optimizing the walk home—which I assure you has happened—is not something that I actually put much thought into or any preplanning. Like Muir, it's a reaction as automatic as breathing.

So am I hugely atypical (for a programmer)? Did programming make me this way? Did I become this way because of programming? I'm hoping the answers are "no", "somewhat" and "somewhat" but who can say for sure? Perhaps I'm just an allegedly functional savant?

I will say that I would be honestly surprised if the higher-order thought processes required to be a good programmer didn't leak into non-programming areas. If it didn't I think I'd find that level of compartmentalization a little disturbing.