On Mon, Apr 08, 2002 at 02:44:14PM -0700, brad lafountain wrote:
> for($i = 0;$i < 10000;$i++)
> {
>  $d = new a;
>  aggregate($d, "b");
>  aggregate($d, "c");
>  $d->method();
> }

That is

$d = new A;
aggregate($d, array("B", "C"));

for ($i=0; $i<10000; $i++) {
  $d = copy $a;
  $d->method();
}

in PHP, with aggregate() taking the array syntax suggested by
me, and copy being to instances what new is to Classes (copy
constructor). As you can see, it is a direct match to your code

> for($i = 0;$i < 10000;$i++)
> {
>  $d = new d;
>  $d->method();
> }

(but $d is already initialized properly in my example, and then
copied, whereas you run 10000 initializations).

>  I currently am trying to talk my company to use php over
> java. This is a huge project. The company i work for has 22000
> employees and probally 500-1000 developers across us (mainly).
> And in desiging our classes i can see where i could use MI.
> and im not about to go and tell all 500 developers that
> evertime you create an instance of x you need to aggerate y.

You don't. There is no need.

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