[dev] Horde_Injector was: Constructive Criticism/Venting

Jan Schneider jan at horde.org
Fri Mar 14 12:22:18 UTC 2014


Zitat von Michael J Rubinsky <mrubinsk at horde.org>:

> Quoting Michael M Slusarz <slusarz at horde.org>:
>
>> * Dependency injection is useless IMHO.  We really aren't using it,  
>> so most/much of Horde_Injector functionality is unnecessary  
>> overhead.  E.g. as our AJAX processes become smaller, the  
>> Horde_Injector overhead because a greater part of the process  
>> runtime.  IIRC, it now takes up to 10%, for things we don't use -  
>> like Reflection analysis on every access (maybe this can be  
>> optimized/cached).  For our (Horde applications) purposes,  
>> dependency injection isn't tremendously useful since we may have  
>> multiple configurations for the same object - i.e. we have  
>> different DB setups for different apps, so each DB object needs to  
>> be manually injected.  Not to mention it is almost impossible to  
>> try to trace/debug the code when using dependency injection.  I've  
>> personally spent hours making small changes in Horde components  
>> code, simply because it can be impossible to try to trace where the  
>> object is coming from.  Horde_Injector is nice as a way to provide  
>> a global singleton/configuration store, but that's about it.
>
> I mostly agree, we have so many backends/configuration options that  
> using a pure DI solution (as opposed to what we do, and use it  
> mostly as a container for singletons) doesn't really work for us.  
> There are a few places, however, in the code where we *do* use the  
> injector's dependency resolver, so we have to be careful about  
> removing any of that functionality. That being said, just because we  
> are not currently using it doesn't mean we should abandon it. We  
> want other developers to use our libraries, so we shouldn't be  
> making this decision for them. I agree we could/should probably  
> refactor things so that stuff like the Reflection analysis doesn't  
> run on every page load.

Agreed. I never really made friends with Horde_Injector and wouldn't  
mind if we could replace it with something different, better. But at  
the moment it's doing best what we currently use it for. And we  
shouldn't drop functionality that make sense in DI solution just  
because don't use it that much. I would welcome optimizing it or  
splitting functionality off though.
-- 
Jan Schneider
The Horde Project
http://www.horde.org/
https://www.facebook.com/hordeproject



More information about the dev mailing list