[Zope-dev] Re: [Geeks] Re: Interface Meta Data proposal

Martijn Faassen faassen@vet.uu.nl
Thu, 7 Dec 2000 16:46:52 +0100


Guido van Rossum wrote:
> > I notice you mention post/pre conditions (something that UML obviously talks
> > about).  I wonder if we want to do a bit of research on Eiffle and it's
> > contractual description.  The only thing I wonder is if some of this is
> > actually useful programatically, if that makes sense? It's great info, but
> > is it useful at runtime?
> 
> In Eiffel (I've never heard of Eiffle :-), pre- and post-conditions
> are turned into run-time checks, just like assertions.  There are
> separate flags to turn code generation for pre- and post-conditions
> off.  This is useful, as follows: while debugging your code, turn both
> on.  When you've fully debugged an application, you turn both off.
> When you've fully debugged a library module, you create two versions:
> one with both turned off, for use in fully debugged applications, and
> one with pre-conditions on and post-conditions off, for use by other
> code that is still in need of debugging.

Note that UnitTests are there for Python now, and they can accomplish
something similar. Advantage is that the tests already separate from 
the code so you don't have to turn them off, disadvantage is that the tests
are too far from the code to encourage their use, perhaps.

A good set of unit tests that are run often during development definitely
feels like a good safety net.

Regards,

Martijn