The thesis I mentionned before starts by saying this:

"One of the main reasons why inheritence is a fuzzy concept in
implementation languages is the fact that it can be used very liberally,
allowing redefinition and even cancellation of derived properties. This is
motivated by code reuse, where existing material has to be modified in a
certain way in order to effectively reuse it. Such actions eventually lead
to loss of conceptual relationships between the original and derived
entities. Preservation of these relationships is, however, the primary
concern in object oriented specifications [..]."

This is the danger of MI/Aggr. People take an object that is almost like
what they want, then use the language to modify its properties. If the
programmer of the object was good enough to protect his object, then there
is no problem, but usually programmers don't really understand OO and how
variables can be accessed from outside of the object, how functions within
the object can be extended the wrong way.

That's why I liked the java implementation. You can only extend 1 object,
then implement interfaces that are clearly defined. The object is
restricted, the interfaces allow you to develop your own system.

Programmers then wanted to be able to get a bit more control of the object,
so they invented beans, which are basically objects with strict getters and
setters, so the programmer of the object knows how his object can be
modified, and the programmers using the object know what are the
limitations.

MI and Aggr, to my view, allow "similarity reuse", which is against the
basic OO, but was introduced in C++ because programmers are lazy and they
like to have control over everything :)

Fab.

----- Original Message -----
From: "Kristian Koehntopp" <[EMAIL PROTECTED]>
To: "fabwash" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 09, 2002 5:01 AM
Subject: Re: [PHP-DEV] Aggregation, Multiple Inheritence, pros/cons


> On Mon, Apr 08, 2002 at 08:57:09PM -0400, fabwash wrote:
> > My vote is "java" like: no MI, no aggregation, single inheritence and
use of
> > interfaces :)
>
> Could you please explain how interfaces promote code reuse?
>
> I am not the perfect java pro, and as I understand it,
> interfaces define a set of instance variables and methods that
> must be there in order to be compliant to an interface, but
> provide to way to import an implementation of such an interface
> into an existing class.
>
> Objective-C had interfaces, which were in fact such lists of
> instance variables and methods, and it had categories, which
> could be implementations of interfaces which could then be
> imported into a class (but could be used in other ways as well).
>
> Kristian
>
> --
> Kristian Köhntopp, NetUSE AG, Dr.-Hell-Straße, D-24107 Kiel
> Tel: +49 431 386 435 00, Fax: +49 431 386 435 99
>

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to