[Zope3-dev] initial topics for z3 doc project

Jim Fulton jim@zope.com
Mon, 11 Nov 2002 17:35:13 -0500


Guido Wesdorp wrote:
> On Friday 08 November 2002 12:05, kapil thangavelu wrote:
> 
> 
> 
>>alternatively we could write a metaclass that checks to insure that
>>interfaces are actually implemented, the interface should contain. the
>>docs. i dunno how the metaclass checker would interact with persistent
>>subclasses though.
>>
>>
> 
> Does Zope 3 still not check on the correct implementation of interfaces?  I
> think that should be done not only for documentation but also to help writing 
> code, maybe it shouldn't throw an exception but at least there should be a 
> way of finding out whether all interfaces are implemented correctly for 
> developers. And of course also documenting stuff from interfaces would be a 
> lot easier if we were sure the interfaces were actually used.

There's a tool that can be used to test whether a class or object:

- Implements all of the names defined in an interface

- For methods, checks the signatures

This is imperfect for classes, since you can't always tell easily
by looking at a class whether it's instances will implement an interface.
For example, an interface may specify a non-method attribute. The attribute
is implemented by setting it in __init__ or something it calls.

Of course, it's not possible (or at least not practical) to automatically
check whether a class implements the semantics specified in an interface,


 > (Although I'm
> not 100% sure if the interfaces provide enough information, the classes will 
> probably implement more functionality then the interfaces describe. Is this 
> code that should be documented as well or not?)

Probably not since:

- You can't tell whether this additional functionality is public or
   whether it's part of the implementation,

- We are doing a pretty good job of specifying things in interfaces.

Jim



-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org