[dev] [commits] Horde branch master updated. 0729ad4e199098207fec994fbac9d34c72e9b436

Michael M Slusarz slusarz at horde.org
Mon Oct 4 20:15:19 UTC 2010


Quoting Chuck Hagenbuch <chuck at horde.org>:

> commit 0729ad4e199098207fec994fbac9d34c72e9b436
> Author: Chuck Hagenbuch <chuck at horde.org>
> Date:   Sun Oct 3 10:41:27 2010 -0400
>
>     Revert "Add ondemand injector binders." These are equivalent to  
> factories.
>
>     This reverts commit e27690055fdcf4896b1a11cdecec1de304c1cffc.
>
>  framework/Injector/lib/Horde/Injector.php               |   55  
> +--------------
>  framework/Injector/package.xml                          |    2 +-
>  framework/Injector/test/Horde/Injector/InjectorTest.php |    8 --
>  3 files changed, 4 insertions(+), 61 deletions(-)
>
> http://git.horde.org/diff.php/framework/Injector/lib/Horde/Injector.php?rt=horde-git&r1=e27690055fdcf4896b1a11cdecec1de304c1cffc&r2=0729ad4e199098207fec994fbac9d34c72e9b436
> http://git.horde.org/diff.php/framework/Injector/package.xml?rt=horde-git&r1=e27690055fdcf4896b1a11cdecec1de304c1cffc&r2=0729ad4e199098207fec994fbac9d34c72e9b436
> http://git.horde.org/diff.php/framework/Injector/test/Horde/Injector/InjectorTest.php?rt=horde-git&r1=e27690055fdcf4896b1a11cdecec1de304c1cffc&r2=0729ad4e199098207fec994fbac9d34c72e9b436

Please revert this -- ondemand injector binders are NOT equivalent to  
factories.  Instead, they are a way to reduce overhead during  
initialization of the injector.  There is a not-insignificant amount  
of overhead in reading all the binder class files from disk (even if  
using a cache), creating the PHP data class objects, and storing these  
class objects in memory.  Considering that most of the binders are not  
used on any given pageload, this is unncessary overhead.   
Additionally, it makes reading debug logs much easier - instead of  
having to scroll through several pages of binder print_r() class  
string output, there is only a single line for each declared binder.

Additionally, it can be argued that the current behavior of  
addBinder() is wrong.  Say, for example, some configuration value used  
in a binder changes during the page load.  In the current system, the  
old value of the configuration will *always* be used.  Using ondemand  
binders, the new value of the configuration may be used if the binder  
is used after the configuration value changes.

I would be all for allowing addBinder() to accept either an object or  
a string and then auto-determining how to handle.

michael

-- 
___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list