Encapsulation, inheritance and polymorphism

Lipska the Kat lipska at lipskathekat.com
Thu Jul 19 10:56:30 CEST 2012


On 19/07/12 07:09, rusi wrote:
> On Jul 19, 6:34 am, Steven D'Aprano<steve
> +comp.lang.pyt... at pearwood.info>  wrote:
>> On Wed, 18 Jul 2012 15:40:00 +0100, Lipska the Kat wrote:
>>> 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.
>>
>> Um, yes?

> 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':
> http://www.cs.utexas.edu/~EWD/transcriptions/EWD06xx/EWD618.html
>
> 'Object' (and OO) are similar messes.

Well this is all very interesting.

The terminology is quite concise if you allow it to be
Take "An Object is an instance of a Class"

A Class describes a human concept (be it concrete like a 'Parrot' or 
more abstract like a 'Session') an Object is an actual representation of 
that concept that exists in the memory of a computer (what else should 
we call it). Objects don't exist in the mind of a human, concepts do. A 
class is a way of representing that concept so that other humans can 
understand it. That's it, really, there is no more, anything else is 
implementation.

> In layman-speak and object is well, a thing.

But we are not talking in 'layman-speak' we are discussing concepts that 
are familiar to us in the 'language of the domain' at least I though we 
were. Academic twiddling with the distorted meaning of words spun by 
vested interests is all very interesting I'm sure but doesn't really 
advance the discussion does it?

> - 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.
> - subject to time-laws like coming into existence at some time and
> going out at some other
> - connotes inanimateness unlike other 'creatures' or 'beings'.

Well here I have to agree with you. Anyone who invents a 'Person' Class 
should be dismissed forthwith. Parrots are OK though.

> 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.

But we are not talking about the 'real world' are we, we are talking 
about representing complex interacting human concepts in a way that can 
be understood by humans and translated into a form that can be executed 
on a binary machine

 > Objects dont.

Well they do, it's a fact, you can call a method on a sub class that 
only exists in the super class. What else would you call it.

Well it's been fun but I have bills to pay so I suppose I'd better do 
some work. TTFN


-- 
Lipska the Kat: Troll hunter, Sandbox destroyer
and Farscape dreamer of Aeryn Sun.



More information about the Python-list mailing list