[dev] [commits] Horde branch master updated. 062155700ae928aa4ce65a7b01aaf1930b0cfaed
Michael J.Rubinsky
mrubinsk at horde.org
Sat Oct 9 16:05:40 UTC 2010
Quoting Chuck Hagenbuch <chuck at horde.org>:
> Quoting "Michael J.Rubinsky" <mrubinsk at horde.org>:
>
>>> I'd like to see every factory and singleton removed from the
>>> framework packages, unless they are actual factories that provide
>>> a default set of configured objects all specific to the package.
>>
>> Wouldn't keeping some of the factories in the framework packages be
>> beneficial for other projects using our libraries? They won't have
>> nice factory binders, so providing some sort of factory method
>> would seem to make sense, or am I missing something else here?
>
> I was trying to get at this with my comment about actual factories.
> The more I think about it the more I think that there's not a lot of
> code here that isn't config or setup specific, and that sort of code
> belongs in core, or in the codebase of other projects using the libs.
>
> I'm definitely open to counter-examples, but if there are, I'd like
> to see them become actual Package_Factory classes, not ::factory()
> or ::singleton() methods.
I started working on this locally, but want to be sure I understand
fully now that I've removed a few of these:
So, for example, the Horde_Compress package (which we don't have a
core factory for), currently has a factory() method. There's no rocket
science in the method, just the typical add $driver name to __CLASS__
and pass $params etc... There is nothing really configuration
specific here, so these type of factories could move to
Horde_Compress_Factory::create()? While packages such as Horde_Auth,
while still containing no core dependencies, requires setup that is so
specific to the client code that we should totally remove the factory
code and instead require the client code to deal with it.
I just worry about consistency across packages for object creation,
but I guess that would be dealt with by documentation.
--mike
The Horde Project
http://www.horde.org
More information about the dev
mailing list