Aggregation, Multiple Inheritence, pros/cons
| From: | fabwash | Date: | Tue, 09 Apr 2002 00:57:09 +0000 |
| Subject: | Aggregation, Multiple Inheritence, pros/cons | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82307@lists.php.net to get a copy of this message | ||
Hello all,
check this Thesis about multiple inheritence and aggregation, especially
chapter 9. It gives an excellent source for debate, and will explain the
main differences between both techniques, the pros, cons, etc..
http://www.cs.tut.fi/~pets/pruuden97.pdf
My vote is "java" like: no MI, no aggregation, single inheritence and use of
interfaces :)
----- Original Message -----
From: "Yasuo Ohgaki" <yasuo_ohgaki@yahoo.com>
To: <php-dev@lists.php.net>; "Brad Lafountain" <rodif_bl@yahoo.com>
Cc: "Zeev Suraski" <zeev@zend.com>
Sent: Monday, April 08, 2002 8:14 PM
Subject: Re: [PHP-DEV] Re: aggergate vs MI
> Brad Lafountain wrote:
> *SNIP*
> > But do you see my point that having ONLY aggregate means that in 90% of
the
> > case where people will use it its probally a bad idea. They are only
using it
> > becuase of the lack of MI. How does aggregation solve overwriting
methods.
> >
> > class a
> > {
> > function blah()
> > {
> > echo "in a";
> > }
> > }
> >
> > class b
> > {
> > function blah()
> > {
> > echo "in b";
> > }
> > }
> >
> > class c
> > {
> > function blah()
> > {
> > echo "in c";
> > }
> > }
> >
> > class d extends a,b,c
> > {
> > function blah()
> > {
> > echo a::blah() . b::blah() . c::blah();
> > }
> > }
>
> With MI, documentation can be generated easily using tools.
> *EASIER* to maintain code.
>
> >
> > how do you do that with aggregation? MI really is way different than
> > aggregation.
> >
> > I see aggregation used for adding methods to an existing class.
> > class a
> > {
> > function do_a()
> > {
> > }
> > }
> > class b
> > {
> > function do_b()
> > {
> > }
> > }
> >
> > $c = new stdclass;
> > aggregate($c, "a");
> > aggregate($c, "b");
> > $c->do_a();
> > $c->do_b();
> >
>
> With aggregate, auto generating documentation hard.
> *HARDER* (very hard, if one use it w/o good reason) to maintain code
>
> To me, aggregate is "GOTO" like feature.
> It's useful for sure, Howver
> _Never_ use unless there is very good reason.
>
> Therefore, it worth to have both MI and aggregate. IMHO
>
> --
> Yasuo Ohgaki
>
> >
> > but i still don't like this... there are cleaner ways around that by
using
> > members and/or MI.
> >
> > - Brad
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Tax Center - online filing with TurboTax
> > http://taxes.yahoo.com/
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>