Saturday, March 8, 2014

The Imperative Programming Life

Freedom Needs Fences

Last year, I gave a presentation to a group of people regarding fences, both actual fences and metaphorical fences. What is the purpose of a fence? For many people in urban areas, fences silently tell us, "Do not trespass," or, "This is private property". In certain cases, particularly around construction sites, fences are a safety precaution: "Enter at your own risk." In rural areas, fences are often used to set aside a safe area, whether you're setting aside an area safe for your livestock or an area safe for your children. In certain cases, the "dangerous area" has an exclave inside your "safe area", such as a well, so you build a fence around it.

What's the point? Many people, particularly in the United States, have the impression that freedom means "no rules". Freedom means doing whatever you want whenever you want to do it. Is that true freedom? If we rid the world of all the rules and there were no legal consequences for any and all actions, what would happen? How long would it be before robbery and murder were again outlawed? How long would it take before people started developing their own rules of law again?

Freedom does not mean "no rules". True freedom means having just the right number of rules with the right amount of leeway to interpret them. What would we be saying if we removed the fence from around the well: "You are free to fall into the well and kill yourself." Would you do that if the well were fenced in your children's "safe area"?

Anyway, you get the gist. One of the other ideas that I presented were some of the metaphorical fences that we build for ourselves. How many of your day-to-day tasks do you do in a specific order and no other? Most pilots follow a checklist in a specific order and don't deviate from it. They do this to make sure that prerequisites are met, safety concerns are addressed, and everything is in order before they take off. When you get in the car, do you do things in a specific order? Have you made a mental checklist for getting into a car and for getting out of the car? These are metaphorical fences designed to prevent doing something potentially dangerous or costly, like driving without the seat belt engaged or forgetting to lock the door when we get out of the car.

Morning Routine

I am a morning person by training; I am a night owl by heritage. My parents were night owls, my brother and sister are night owls, and I usually stay up all night with them when we're all together. However, I have had to learn how to get up and operate in the morning and, by and large, I am usually required to get up in the morning. Gone are the days of sleeping until 5 p.m. like I would on Saturdays and Sundays during the college term. Gone are the summer days where I slept all day and studied Latin all night.

I understand the dangers studies pose about hitting the snooze button. When I was teaching myself to be a morning person, I also learned how to wake up and operate with the first alarm and try not to hit the snooze button. I've not been totally successful, but I wake up more completely and quickly than anyone else in my household on the weekdays. This essentially means that I am the driving force behind the family's morning routine, particularly in helping my son get ready for school.

You got it. There's a routine. There's a mental checklist. Believe me, if I do something out of order on that checklist, I've lost time trying to figure out where I am, what I've done, and what's left. I stick to that mental checklist because, if I deviate from it, my wife may not make it to work on time, my son may not make it to school on time, and I may not make it to work on time. I've built this elaborate, metaphorical fence to prevent those consequences.

Metaphorical Wells

Another metaphorical fence we sometimes build for ourselves crops up when we use complex machines, like household appliances and computers. The more complex the machine, the less most people tend to know about the available functionality. Do you understand all the ways you can operate your microwave oven? Does your stove do things you didn't know it could? When you use your word processing application, are there huge areas of functionality that you've never explored? Do you even know they're there?

I venture to say that most web programmers don't know all the tags available in HTML. Most CFML programmers don't know all the CF tags and functions available in that language. Don't worry: I've got three fingers pointing back at me and I know it. We've found what we need to get along and, to a certain extent, fenced off the rest until we're good and ready to explore those areas. Many programmers, comfortable with their knowledge of the language and uninspired to expand that knowledge, may never explore those areas.

Let's look at the well now. Are there portions of your word processing software that you used once upon a time and it didn't work correctly or didn't do what you expected it to do? Did you find a workaround and never try using those portions again? That's another fence. "The software says it can do that, but it's buggy, so I do this instead." Are there similar aspects of your language of choice that you avoid because you never got it to do what you expected it to do or it was broken?

The Imperative Programming Life

My son recently got on another of his stints watching the same movie repeatedly. This time, he was watching "WALL-E". On our way home from school, he was asking me some questions. There are three main characters who are computer-driven: WALL-E, EVE, and AUTO-PILOT (nicknamed "AUTO", which comes out sounding like "OTTO"). These characters and others in the movie are given "personality".

My son asked me, "Why didn't AUTO want to go home?"

"AUTO was programmed not to go home."

"But the captain said it was ok. Was AUTO afraid to go home?"

"No, AUTO was programmed to obey commands. He was commanded not to go home. Remember: Computers are really stupid; they're just very good at following instructions."

He then transitioned: "Why did WALL-E keep cleaning up?"

"That's what he was programmed to do."

"But there was nobody left. Why did he keep cleaning up?"

"Did someone tell him to stop?"


"Nobody told him to stop, so he didn't stop."

Do you find yourself performing actions a particular way, in a particular order, hesitant to change because you're afraid of the consequences? Do you continue doing something, even when it doesn't seem necessary anymore, simply because you were never told to stop?

Credit goes at least partially to my father, Norman Rowe, for the "Computers are stupid..." quote. I don't know if he got it from someone else, but I got it from him.

No comments:

Post a Comment