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).

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

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to