[dev] [commits] Horde branch master updated. 84f940a08d731fdaed36bc7e7000c0e0ad3e74e4

Michael M Slusarz slusarz at horde.org
Wed Jan 29 19:05:23 UTC 2014


Quoting Jan Schneider <jan at horde.org>:

>> 6c46e57 List a few more package factories as deprecated
>
> This makes sense from a Horde POV, but I'd rather like to keep  
> package factories, because they may make life easier for 3rd party  
> library consumers.

But what's the point of package factories anymore?

* Including driver files?

This may have been the main reason before to use factories, but it is  
no longer an issue with mandatory autoloading.

* Ease of use/shortcut?

No.  If you are a package consumer, to use a factory you not only have  
to read the documentation on the factory call, but you need to go to  
the actual driver documentation anyway to look up the various  
parameters for that driver.  So you are adding a layer of complexity  
for no reason - if you are required to go to a driver page anyway,  
seems to be much easier to just use that constructor directly.

* Error checking/handling?

Nope.  A bad classname is a bad classname.  A factory might make it a  
tiny bit easier since it formats an Exception slightly nicer.  But  
your code is going to fail in either case, so this is splitting hairs.

And this is a logic error anyway, instead of a run-time error, so we  
do't need fancy error reporting since it is not going to be user  
displayed.  (In Horde, *we* are turning instantiation from a logic ->  
run-time error since we are dynamically creating the classnames.  It  
is the responsibility of that code, not the underlying package, to do  
sanity checking on these classnames.)

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list