brad lafountain wrote:
> Unless someone could give me a real reason that 
> aggerate is better than MI.

Aggregation does at runtime what MI does at compile time.
Delaying the decision to "do" something is usually an enable for
specific applications. 

Examples are the signal/slot  mechanism based call-models  in
Gnome and Qt vs. virtual function tables in C++. The decision
which implementation for a method is being called is delayed to
the actual point in time when a call is being made, enabling a
much more flexible component model and much better reuse.

The cost for doing things late is worse typechecking, errors are
potentially caught only at call-time, not at compile-time (with
Qt, it probably is link-time, due to the way it is implemented).

The same goes with aggregation. Aggregation allows me to write a
class "Soaping", which implements a SOAP RPC Client and a
SOAPFactory class, which manufactures objects of any class and
aggregates Soaping into them:

I could include_once() any unknown class, create an instance
and use PHPs introspective functions to create a list of 
functions and instance variables in this class. By adding 
Soaping functionality to the class, and with the help of 
getters, setters and wrappers provided by overload(), I 
can intercept all accesses to this instance, turn them into
SOAP calls to some remote instance of that object, and
marshall the results back into my application.

The beauty of this is, that I can do this at run-time, and that I
can do this generically with any old class, using two miniscule
additions to the system, aggregate() and overload(). Yet for the
user this is probably transparent.

> Class definition is defined at design time not run time!

No, it isn't. Unless you are stuck with C++.

PHP is for rapid prototyping. That may turn into rabid
prototyping (SCNR the pun) if you do not know how to use it, but
it may also be an extremely powerful tool as I have shown. 

Generally speaking, it allows you to design metaclasses and
metasystems, which add some general function to the language
itself.

Kristian

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

Reply via email to