[Zope-dev] Re: zope.traversing dependencies

Tres Seaver tseaver at palladion.com
Wed Nov 21 13:59:56 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thomas Lotze wrote:
> Tres Seaver wrote:
> 
>> +100 to shedding the dependencies.  Could we have the conditional import
>> work as a fallback to a utility lookup?  And then change
>> 'zope.applicationcontrol' to register such a utility?
> 
> This should be possible, but the utility lookup would have to be
> conditional as well since it would have to target
> zope.app.applicationcontrol.interfaces.IApplicationControl which may not
> be available either after the dependency on zope.app.applicationcontrol
> has been lifted.

Hmm, I guess I hadn't realized that the interface was in the zope.app
package.  Shouldn't the interface be in a more "dependable" package,
from which clients can import it without depending on a given
implementation?  One logical place for the interface is actually in
zope.traversing:  that would break the dependency inversion.

> OTOH, if the application controller were to be registered as a utility,
> should it stay importable from the module, at least for a transition
> period? If zope.app.applicationcontrol.applicationController was removed,
> would it be sufficient to adapt the zope.app.publication tests, or are
> there other packages expected to break in that case?
> 
> Philosophically, when is it best to provide something like the application
> controller as a global utility and when is it sufficient to bind it to a
> name in a module?

Philosophically, a utility lookup allows for pluggability:  it is a
looser coupling (to the implementation) than an import.  I would prefer
such an indirection over dependency cycles, any day of the week.



Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHRIAs+gerLs4ltQ4RAuf3AJ0eQtloAkzay4NlbEbYob5sUJh4+QCgr1M4
bAqX0YqQrxpq1A5/Ir1cPiw=
=NQgZ
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list