Encapsulation, inheritance and polymorphism
rustompmody at gmail.com
Thu Jul 19 08:09:13 CEST 2012
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
'Object' (and OO) are similar messes.
In layman-speak and object is well, a thing.
- 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'.
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.
More information about the Python-list