[Zope-dev] Re: relocating Zope 2 core interfaces - a proposal

Philipp von Weitershausen philipp at weitershausen.de
Fri May 6 12:34:28 EDT 2005


yuppie wrote:
>>> 4.) Making interfaces.zcml point to the new locations. [Five 1.0+]
>>>
>>> 5.) Adding unit tests that verify interfaces and implementations. 
>>> [Zope 2.8.0]
>>
>> IMHO that's yagni. We actually don't use interfaces that much for 
>> verifying implementations anymore. I think their most common use in 
>> Zope 3/Five is documentation, API/schema specification, and easier 
>> spelling for security declarations.
> 
> ???
> 
> Who is 'we'?

The Zope 3 developers.

> How do you make sure documentation and specification are in sync with 
> the implementation? AFAICT verifyClass() is quite useful for that.

Your unit test should exercise the whole API promised by an 
implementation anyway, so often an explicit interface check is redudant 
(of course, it can't hurt). verifyClass() per se isn't bad, it's in fact 
a useful indicator, but having that it as a *sole* measure whether a 
class fulfills an interface or not is not sufficient (plus, in many Zope 
cases, verifyObject is better because attributes may only be initialized 
in __init__).

The point why I think it's YAGNI is that we know the Zope 2 
implementations do implement the interfaces. After all, I derived the 
interfaces from the implementations by gutting out the code. And it's 
unlikely they'll change (although I might be wrong on this one, in which 
case you win :)).

Philipp


More information about the Zope-Dev mailing list