[dev] Horde_Image stuff...

Chuck Hagenbuch chuck at horde.org
Sat Oct 20 03:41:15 UTC 2007


Quoting Michael Rubinsky <mike at theupstairsroom.com>:

> Been thinking thorough some of this some more...I'm wondering about   
> the way the Decorator interface is currently coded.  I kind of went  
> in  the direction it looks like it was heading based on what was  
> already  started.  Currently, to apply an effect, we would:
>
> <code>
> $decorator = $image->getDecorator('effectname', $params);
> $decorator->draw();
> .
> .
> $another_decorator = $image->getDecorator('another_effect', $params);
> $another_decorator->draw();
> .
> .
> $image->display();
> </code>
>
> It makes more sense to me to simply have a method like   
> addEffect('effectname', $params) or something similar that wouldn't   
> actually return the decorator, just apply that effect to the image,   
> since that's all the decorator is doing anyway....which leads me to   
> the next point, these aren't really Decorators, in the true OO  
> pattern  sense of the work, at least not as far as I understand the  
> decorator  pattern....they are supposed to implement the same  
> interface as what  they decorate, no?  So, and I think Chuck had  
> made this suggestion  somewhere..maybe on irc, that these should be  
> called something else,  maybe Plugins or Effects?

Yes. I think the Decorator idea is sort of dead without autoloading  
(which means PHP 5, so Horde 4, so later :).

Calling them Effects and having an addEffect() method sounds like a  
very reasonable solution for right now.

-chuck


More information about the dev mailing list