[dev] Granularity of our framework dependencies

Michael M Slusarz slusarz at horde.org
Wed Oct 20 16:21:41 UTC 2010


Quoting Jan Schneider <jan at horde.org>:

> Zitat von Gunnar Wrobel <p at rdus.de>:
>
>> Hi!
>>
>> When looking at the package dependencies of our framework  
>> components I occasionally notice dependencies which are declared as  
>> "required" though one could also consider them optional. I'm not  
>> really certain how we actually handle the required vs. optional  
>> distinction.
>>
>> Let me give you an example. The following is the dependency tree of  
>> the "components" application:
>>
>> $ php -c php.ini horde/components/script/horde-components.php -L  
>> horde/components/

Wow - this is cool. :)  Wasn't at hackathon so could someone fill me  
in on what components is used for?


>> Now I can imagine different positions:
>>
>> - We could require to split modules to the smallest units possible (so
>>   Horde_Support_Backtrace would be it's own little package). Would probably
>>   mean lots and lots of new tiny packages.
>>
>> - We could mark such dependencies optional. This may hurt in case somebody
>>   installs a package without optional dependencies and requires a class from
>>   the package that happens to rely on the optional dependency. It  
>> might not be
>>   obvious what needs to be done to fix the situation.
>>
>> - We can live with a tree with somewhat bloated dependencies and so this
>>   does not need fixing.
>>
>> - This has no generic solution and should be discussed on a case by  
>> case basis.
>>
>> I'm willing to accept all those positions. At the moment I just  
>> wonder what others think.
>
> My take is that we should only use optional dependencies if the code  
> has a graceful fallback if the depency is not installed. As soon as  
> some code in the package fails if the dependeny isn't installed, it  
> should be a required dependency, even if it's only a single, rarely  
> used part of the code.

Agreed.  Even if it is in some remote area of the code, if that  
codepath would fail without the dependency it is required.  At least  
that's the way I've been determining things manually.

> So, this only leaves option 3. We should try to avoid dependencies  
> as far as possible though.

Less dependencies is always a good thing, but sometimes it is  
necessary.  Example: I currently have the dom extension as an optional  
dependency for Text_Filter.  I did that because I skip the  
functionality if it is not available.  But for things like the XSS  
driver, it is pretty much useless without dom - it won't do any  
scrubbing at all, it just silently skips it.  So I am reconsidering  
reverting that dependency to required.

michael

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




More information about the dev mailing list