Search This Blog

Saturday, July 21, 2012

We don't need no Ooooo-Orientation – 1

When I was younger, I believed that OO was THE (or at least one important) solution to programming problems.  Over years Ive come to see that OO works in some cases and fails badly in many others. So I intend to blog on and off about my reservations with OO. I'll start off with touching on…

Problems with OO Terminology

Below is something that I discussed on the python list ; started off by “Lipska the Kat” saying the following:
Object Oriented programming is all about encapsulating human concepts in a way that makes sense to human beings. Make no mistake, it is NEVER the case that a software system is written for any other reason than to serve human beings. OO is more than just the mechanics of writing code, it's a state of mind.
Its not so much a question of language as in programming as language as in layman-speak.­ ­­ ­
One characteristic with our field is that we take ordinary words and then distort them so much the original meaning is completely lost.

Take ‘computer’ for example.  For Turing a computer was a mathematician doing a computation with a pen and paper.  He then showed how to de-skill the mathematician so much that a machine could do what he was doing.  In trying that he also hit upon the limits of such 'de-skilling' — human-computers routinely detect infinite loops, whereas machine-computers can never do so (in full generality).

Ironically the important lesson is lost and today 'computer' is synonymous with machine. Here is Dijkstra on similar distortions with 'user' and 'intelligent'.

‘Object’ and ‘object-orientation’ are similar messes.

Laymen speak of objects as.. well... things.  Things...
  • are subject to space-laws like can only exist at  one place at a time,there cannot be two objects at the same place and time etc.
  • are subject to time-laws like coming into existence at some time and going out at some other
  • connote inanimateness, as against when we say ‘creature’ or ‘being’.
When this metaphor works – for example as in GUIs and simulation – then we have success-stories like smalltalk and simula.

When it doesn't the success is poorer. eg a programmer writing math software in/on a OO system may for example 'clone' a matrix.  This may be good science-fiction; its bad math.

And one of the most pervasive (and stupidist) metaphors is the parent-child relation of classes. Just for the record, in the normal world ‘creatures/beings’ reproduce and therefore inherit. In the real world…

Objects dont inherit. At most they may be classified.

Before I continue though, it may be appropriate to discuss other errors and stupidities in IT/CS terminology that does not directly/necessarily connect with OO.

No comments:

Post a Comment