Not fully OO ?
kay.schluehr at gmx.net
Sat Sep 20 22:22:23 CEST 2008
On 20 Sep., 18:33, Bruno Desthuilliers
<bdesth.quelquech... at free.quelquepart.fr> wrote:
> The following definitions are AFAIK the only commonly accepted
> definitions about OO:
> 1/ an object is defined by identity, state and behaviour
> 2/ objects interacts by sending messages each other
> 3/ an OO program is made of interacting objects
> I let you find out whether Python meets these 3 definitions - and if
> Java does (hint : in Python, everything you can bind to a name is an
> object - this is not true in Java or C++).
This is correct but it detracts from a more general problem of
Assume you type
Now you are free to interpret this as a simple, primitive arithmetic
operation but you can also claim that 2 sends an __add__ message to 2.
Hereby the state of the 2 objects are not altered but a new 4 object
is created. OO babble is more impressive isn't it?
Actually it is simply wrong in the mentioned case and here is the
2 0 LOAD_CONST 2 (4)
OO is a heuristic method used to understand the semantics of a
programming language. It can also inspire language design but as
you've rightly said: jugde yourself and see how far you get with it.
Applying OO on interpreter level is by no means a sign of a high
quality implementation whereas structuring programs in the large will
likely benefit from class based organization and encapsulation. Of
course one can also reverse the value hierarchy and find perverse joy
in having a pure OO language but apply monkey patching everywhere. I
suppose you know which language I'm talking about...
More information about the Python-list