07 March 2008

Fundamentals of OO (aka FOO)

Whenever I happen upon a beginner's introduction to OOP (why this happens to me is another story altogether), there's usually a long-winded account of how a Cat is a kind of Mammal, and so is a Dog, and a Mammal is an Animal, blah blah blah.

OO is basically about types, and types came from ... guess where ... Typing!! Ladies and Gentlemen, this is not a joke!! Gutenberg (the person, not the free online book project), credited with the invention of Movable Type (the printing system, not the blogging software, we're talking 15th century here), used Types for creating printed representations - instances, one might say - of letters.

So there you have it, OO in a nutshell, you have a Type, and from it you create as many instances as you desire. Object Oriented Programming is the direct descendant of the humble TypeWriter. The Type is not the instance, and vice-versa, although the characteristics of the Type evidently determine the characteristics of the instance.

Please unlearn everything you might have read about Cats and Dogs and Mammals, it's BS.

(picture under GFDL, borrowed from Wikipedia, thanks to Daniel Ullrich)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.