Hal writes:
>I'm working on a DBC mechanism in Ruby. Let me crank
>a little longer and I'll make it public for everyone's
>comments and changes. And there WILL be changes. :)
Excellent! Best of luck.
The big thing is to make sure that inheritence is handled properly.
If you define an invariant for one class, it has to be called on
exit from any method in that class and any subclasses as well.
Similarly, a precondition or postcondtion on a method still has
to be executed even if a subclass has redefined the method itself.
Somehere here I have a paper on Eiffel-like assertions in Smalltalk
(I think it was from a university in Spain), I'll see if I can
dig that up.
I find DBC to be an amazing tool to find obscure bugs, and
even just *thinking* about what the preconditions and invariants
for a class should be is a huge help.
/\ndy