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

Martijn Faassen faassen@vet.uu.nl
Fri, 18 Jul 2003 23:55:37 +0200


Phillip J. Eby wrote:
> At 06:49 PM 7/18/03 +0200, Martijn Faassen wrote:
> >Okay, asking some questions. Perhaps they're wrong, but I'm just
> >throwing them out.
> >
> >Wouldn't this be too implicit if you can just register against any class
> >directly? At least with this proposal you have to *say* something to
> >make the class useable that way.
> 
> Why should you have to? 

Because explicit is better than implicit.

> What if you didn't write the class?

A possibly not overly pragmatic answer back would then be that this class
really really needs an interface then, if it can be used that way.
Views on classes as proposed I understand are more to support evolving
code, not ways to reuse code someone else wrote that you cannot change.
Perhaps you have another opinion on this?

[snip PyProtocols propaganda :)]

> >Wouldn't it be conceptually confusing -- won't people wonder what the
> >difference is between a class and an interface even more? With this
> >proposal people still deal with interfaces and interfaces only.
> 
> Which still requires explaining interfaces, and isn't any easier than 
> explaining why you *have* to have an interface when you don't intend to 
> make your class replaceable, or need to document it right away, etc. etc.

You have to have an interface in order to use it with the component
architecture. So far a 'Component' in Zope 3 terms have been described
as a class with an interface. If it is possible to use the CA machinery
directly on classes, this story will need to change.

[snip]
> >Wouldn't the introspection code become more complicated
> >if it is now possible to define views against classes?
> 
> Introspection code?  Huh?  Not sure what you're talking about, but in 
> general I'm against introspection as a means of dispatching.  Don't know if 
> that's related to what you're talking about or not.

I should've been more clear. What I meant is that code that tries to
figure out (for instance for documentation or for a kind of IDE or
perhaps to even support part of the CA) what is connected to what will
now have to take classes into consideration too. This might mean
more special casing.

Regards,

Martijn