Luck, Be a Programmer

May 18, 2011 at 8:39 am | Posted in Technical Tips | Leave a comment
Tags: , , , , , ,

The more you do system design, the more insanely philosophical you become. So, it’s not all that surprising a recent lifehacker article on the nature of “luck” caught my eye last week. The article was a reflection on a 2003 study conducted by Richard Wiseman (The Luck Factor).

The study addressed a specific characteristic of “lucky” people: chance opportunities. Wiseman gave a group of people a newspaper and asked the participants to determine the number of photographs. The “unlucky” people took about two minutes to get the number, while the “lucky” people took mere seconds. This is because the “lucky” people noticed the following message in large print on page 2:

Stop counting – There are 43 photographs in this newspaper.

The “unlucky” people were so focused on counting photographs that they somehow ignored this page and moved onto the next photograph. To add more insult to injury, Wiseman  added another page halfway through the newspaper with the following message in large print:

Stop counting, tell the experimenter you have seen this, and win $250.

Again, the “unlucky” people not only wasted their time, but also lost an opportunity to win some money. Wiseman concludes that “lucky” people are those that notice opportunities and take them, rather than just plod through repetitive tasks without looking up. “Unlucky” people focus too much on the task at hand and sometimes miss the bigger picture.

I think it’s a fair argument that the difference between these two types of people is not necessarily “luck” in the traditional sense, but really a difference of mindset. Alan Carter, in his excellent blog The Programmer’s Stone, documents the two different mindsets as follows:

  • Packers – Stack information like plates on top of each other.
  • Mappers – Build information into complex systems.

Packers are task-driven, focused on step-by-step procedures, and excellent at trivia. In the packer mindset, information is like a soup. When a packer learns new information, that information is simply mixed in, even though it may conflict with existing information. If two “flavors” of information completely contradict each other, then the strongest flavor is kept and the other discarded.

Mappers are concept-driven, focused on the relationships between concepts, and excellent at jigsaw puzzles. A mapper is more likely to make an educated guess than to pull out an actual fact. In the mapper mindset, information is more like building blocks. When a mapper learns new information, that information is examined and incorporated into the existing building. If it conflicts, then the building is modified or redesigned, so that it fits with the existing “blocks” of information. Rarely is a block discarded, because each block should fit into the larger structure. If there is no way to squeeze the block in, then the building is demolished and rebuilt in another way so that it does.

These two mindsets describe the difference between procedural and object-oriented programmers. Procedural programmers sometimes focus so much on tasks that they miss common patterns and opportunities for simplifying and generalizing their code. Good object-oriented programmers are those that focus on the relationships between tasks and see the bigger picture. Of course, to write good programs, you need a bit of both mindsets. There must be a balance between work and imagination.

So, luck has more to do with keeping your eyes open for alternatives, rather than just doing the same thing you’ve always done.  You’re not guaranteed to get lucky, but if you follow the same route over and over again, luck is guaranteed to evade you.

–codeguru

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: