Divide and Conquer

It started out with David Lemphers posting up about this article called The Expert Mind(pages 1, 2, 3, 4, 5, 6)  Darren chimed in and then Geoff added to the conversation (don’t you just love the way the blogosphere worked). Darren must have figured that I would be interested in the thread of conversation so he IM’d me a link to the David’s post – he was right.

The article spends a lot of time covering some of the techniques that chess players use to organise their memory such that they can play well. One of the techniques is chunking where the players use the board layout or fragments of the board layout as a key to access winning moves or at least winning behaviours.

David drew a parallel between this and programming and how quite possibly there are coding movies that we can apply to produce better code (if your memory is a hashtable then David is focusing on the value of the key value pair). Darren looked at it from the opposite angle (the key). They are both talking about different sides of the same coin – unfortunately it is a pretty abstract discussion – lets see if I can ground it in some general observations I’ve made over the years.

When I first _really_ started to learn to program Pascal was my tool of choice, and the person that was teaching me how to program basically used the same top level structure to every program that he wrote:

  1. Initialize
  2. Process
  3. Terminate

These would each be PROCEDURES and the idea was that this represented the lifecycle of pretty much every program ever written and from here you can start to break down the problem. It was a very structured and procedural way of thinking – but it worked.

One skill that this taught me was that the way to approach programming (and problem solving in general) is to divide the problem domain continuously until you find a solution. By dividing the problem domain and focusing on just that division then you remove a lot of the noise which slows you down (and eventually disables you).

I’ve found that this ability has saved me time and time again from getting stuck on one particular problem – all I have to do is remember to break it down. This is fundamentally the same skill that chess players are using (although their capacity for recall seems to be amazing). I think that the challenge that we face at Readify is finding the people that know how to break it down but also have the discipline to actively learn new moves so that they can recommend what the logical divisions in a problem are.

My moves?

I’ve got one for your Dave. One of the classic moves I have is around the double check in threading – the mental trigger for this in my head is actually working with a list in a multi threaded program where multiple threads might me working with this same list and manipulating it. But its only one possible code move, and it doesn’t always win (but it has reasonable probability).

I’m off to play some chess to see if I can exercise my brain a little (mind you, the article did say that the recall skills don’t necessarly span problem domains).

One thought on “Divide and Conquer

  1. Pingback: David L's Blog : Debugging your Consultants!

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