Introduction to the problem

So, there is this thing, and pretty much everyone thinks it’s the bee’s knees. It’s called Object Oriented Programming. It’s fairly important and, at least at one point, it was more or less hailed as the salvation of coders[1]. It was believed that Object models could do anything. All code could have a magical “interface” and there would be “inheritance”, which would mean that you could write one thing once and have it work for all time in infinite verbosity.

That… is a tad of an exaggeration.

Back in the 1980′s[2], computers were starting to be able to actually do things. For the first time, home computers were available to the masses and many of larger businesses began including them in day-to-day tasks. To keep up with the demand for machines, an equally important (and possibly more important!) increase in software was necessary.

Not only were computers now available to the consumer (admittedly, they had to be a slightly more well off consumer: Apple ][ (originally from the late 1970's) originally cost $1,298[3], and in modern money that puts it at over $3,500), but there was the advent of the Apple Macintosh in 1984.

So began what could be called the first great code rush. With the explosion in popularity of computers, suddenly there came a realization, “We’re doing the same things over and over again. That sucks. How can I we be lazy and avoid all of this pasted code?” (I maintain that good programming involves systematic laziness[4])

Here’s what the problem was. Say you have the Bremen Town Musicians (we’ll call them BTM for short). Now, BTM is a group of animals: a rooster, a cat, a dog, and a donkey. Before object orientation came along, it was very common to see programs where there were four separate functions: tell_rooster_crow, tell_cat_hiss, tell_dog_bark, and tell_donkey_bray. Each of these would have something like _exhale and _use_vocal_folds.

This causes two problems. First, we have a naming issue[5]. If Nasty Norman (who is a quintessential bad programmer that happens to be in charge of dogs) decides to name his animal breathing function “breathe” and Simple Simon (who is another quintessential bad programmer and happens to be in charge of donkeys) decides to name his function “breathe”, we have a problem (admittedly, this is a very simple example, so the solution wouldn’t be that difficult[6] — but in larger projects, eventually all of the simple names would be used up and people would need to start using large, cumbersome ones to do any work).

The second issue is that both of those programmers would have to do almost the same thing (getting vocal folds to move in mammals is remarkably similar between species, after all). This will inevitably lead to people doing the same work multiple times.

Then, one day, someone came up with the idea, “Hey.  What if we could just tell each of these animals to do the same thing?  Then I wouldn’t have to remember to tell_rooster_crow.  I could just tell all of them to makeNoise!”[7]  They then decided to objectify the animals, but because that was the original issue the BMT were fighting against[8], the community called it “Object Oriented Programming” instead.


So that is the beginning of the problem. Wasn’t it fun? Or, rather, wasn’t it annoying that I gave just a hint of how something might happen without actually going into any of the relevant detail?

It’s all to get you to tune in for the next topic, The Importance of the Solution

  1. [1] Until upper management heard of it
  2. [2] I know, you could argue that it started as early as the 60′s with Lisp, or you could say that it all became popular in the 1990′s with the true popularization of the techniques, but I’m telling this story. When you tell this story you can give your own dates.  (In case you’re wondering, “the early ’80′s” also happens to correspond with the origin of SmallTalk)
  3. [3] Wikipedia entry on Apple ][
  4. [4] It’s something like this: What is the minimum amount of effort to get the maximum result so that I can leave this and work on my own pet project, which is likely overly complicated and despite my best intentions will likely die on github or bitbucket because I will eventually lose interest
  5. [5] If you want more on this, look up namespaces
  6. [6] You might want to put them both in a circle and have them fight while Star Trek TOS fight scene music plays in the background. Whether this fight is to the death or not is up to management.
  7. [7] See what I did there?  Notice the change from underscores to camel-case?  That also happened in the early 80′s, about the same time, actually.
  8. [8] That’s the last thing we need, a chicken testifying before congress.  With all of the turkeys involved already, it would be too ill-disposed towards cattle

One Response to Introduction to the problem

  1. John says:

    Thank you, this was very good post. Can’t wait to read more!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>