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

Tres Seaver tseaver at palladion.com
Fri May 6 12:49:29 EDT 2005


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

Philipp von Weitershausen wrote:
> 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 :)).

When writing "test-first", I often start with only the 'verifyClass'
test, and an empty interface.  Then as I flesh out the interface, the
test fails, reminding me to add the method / attribute.  Yes, you still
need tests for the semantics, but the conformance test is still
valuable, because it "tests the tests" (an extra safety belt).


Tres.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCe6AZ+gerLs4ltQ4RAhmqAJsHMI0T4V+p+RIcOBE4stCgxWBDgACfTAHG
vrqWMXOBPVH98hheB4Ao0r8=
=c00Z
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list