DesignByContract (was RE: utilizing ++ and -- for comments)

//I think I'll use an interface like this:
//
//class MyArray
// def pop() ... end
//
// check :pop, :pre do
// size > 0
// end
//
// check :pop, :post do # couldn't think of a better sample here
// size >= 0
// end
//
// check :invariant do
// size >= 0
// end
//end

Yes. Sorry Florian I did not see your project. But now I am very happy that
you are involved in it.

Regarding the interface, I was hoping you include the conditions inside the
method. This is important to me since it is the methods that I am after as
of now.

eg. like

#-- sample code only
def Method_sample
    pre {
         #-- a code block that must evaluate to true...
         #-- ...
    }
    post do
         #-- a code block that must evaluate to true...
         #-- ....
    end
    #-- normal method code here...

end #-- Method_sample

I am following pattern suggested by Andy Hunt (attached pdf)

Your idea of putting variants at class levels (not methods) is great but I
fear it might be too big a task to implement (only me sizing). But if you
can do it too, why not?

thanks and kind regards -botp

dbc_ruby.pdf (12.4 KB)

···

Florian Gross [mailto:flgr@ccan.de] wrote: