[Zope3-dev] Allowing views to be registered for classes rather than interfaces.

Martijn Faassen faassen@vet.uu.nl
Tue, 15 Jul 2003 18:21:07 +0200


Stephan Richter wrote:
> On Tuesday 15 July 2003 08:07, Martijn Faassen wrote:
> > The point about the interface hierarchy is to allow multiple
> > implementations of the same interface. Are the schemas described here
> > designed with this in mind? Or does one really only ever expect a single
> > implementation?
> 
> That depends on what I am working on. Here I guess I meant that we only have 
> one implementation (which most interfaces will).

I think it is odd that most interfaces will have only a single implementation.
It shouldn't be that way; I think if something is to have multiple 
implementations an interface should be provided, but an interface
should not really be necessary if you only ever expect one implementation. 

You can argue a separate interface helps one clarify the structure of the 
code, but I don't really buy that; a class with docstrings works just as 
well. Having to maintain a separate interface in sync with the class is a
bother and reminds me of C++ header files, which is not a good memory. 

> and I really did not care if it would have been 
> 
>   <require
>       permission="zope.ManageServices"
>       interface="zope.app.index.text.interfaces.IUITextIndex"
>       attributes="query" />
> 
> In fact, the latter makes more sense to me.

In a sense the 'interfaces' module name helps create a separate
namespace of its own. One risk of this approach would be if I'm going to install
Zope 3 without some of the zope.app packages installed. I'm not
sure whether this is intended to be possible, though.

Regards,

Martijn