2012-10-20

Divide and conquer

This blog is read by a wide range of people, both technical and non technical. The problem is that some of the posts are totally meaningless to some of the people reading my blog. Obviously Pauline, who is now master of iPhone settings, has no problem understanding my latest post on OSPF, but for anyone else, here is a bit more of an explanation of what the hell I was talking about...

The post was about OSPF (which stands for Open Shortest Path First). You probably don't want to really know all of the details. In practice it is a protocol. This is much like you might expect in normal English. In life there is protocol for formal events, or how one talks to the Queen, or anything where there is some communications. It is all about everyone pre-agreeing the way things are done, so there is no misunderstanding. The same is true for computers, but typically in a lot more detail. OSPF is such a protocol - it is a set of rules for how computers talk  to each other in a specific set of circumstances. In this case the protocol itself is about routing which is itself a process for how computers communicate with each other. So it is a communications protocol about how computers agree on how they will communicate information in future (confused yet?).

In order to make something (a computer, but in this case it is the FireBrick) handle this protocol, we have to write software. This is kind of what I do. I have written software since I was in secondary school. Software is simply a set of instructions, much like a cooking recipe tells you the steps to make a cake, the software tells the computer how to do something, in this case how to handle this particular protocol. Software is a tad different to a cooking recipe in that the steps that the computer follows are very detailed, and there are a lot of them. Software can be hugely complex.

The problem is that software can be so big and complex that you can't just start at the beginning and write it. It is not like reading a book. You have to work out the overall plan, the architecture. Like making a complicated building.

So, in order to write the OSPF software I have divided the problem up in to several distinct steps. I described three steps in the OSPF post. This is making the larger problem smaller. Each smaller step is easier to write, and, importantly, to test works before moving on to the next step. Completing each step you can see how far you have got, and have some sense of achievement.

This can be done at different levels. For example, my first step, as I explained, is the "hello protocol". This is one small part of the way OSPF works. As the name suggests it is how the computers "say hello" to each other. Having done that they can go on to say more interesting things. But even this first step can then be broken down in to smaller steps. You have the saying hello, and the bit where other computers say hello to you. Both of these have steps, e.g. where you construct the actual message itself with all its parts, and send the message in a way that the neighbouring computers will be able to get it. There are various parts to the messages, including authentication (which is like showing your ID card to other computers so they know you are who you say you are). So each step in the process can be broken down in to smaller steps.

This divide and conquer approach is a sensible way to tackle any large problem, and is quite important when writing software for computers.

There are other tricks of the trade. It is not always about taking a large problem and reducing to smaller steps. Some times I also work out the tools I need - the building bricks that are at the bottom. This is like building some foundations you know you will need even before you have worked out these top level steps. So some times the software is built from the top down and from the ground up and meets in the middle. This usually works well from lots of experience - knowing right away what these building bricks will be, making it easier to then divide the problem up in a way to use the tools you have constructed.

Hopefully the helps explain a bit more of what the OSPF posts are actually about, even if you do not understand all of the details.

3 comments:

  1. It's Open Shortest Path First http://tools.ietf.org/html/rfc2328#page-6
    Definitely a good explanation for the uninitiated

    ReplyDelete
    Replies
    1. Typo corrected - I blame the time of day :-)

      Delete
    2. 3:32 being your local time then :-)
      Fair enough to blame it

      Delete

Comments are moderated purely to filter out obvious spam, but it means they may not show immediately.

Playing cards

One of the fun diversions I have had in my time was making playing cards. I did a whole chapter in my biography on this. My playing card des...