[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: DesignByContract (was RE: utilizing ++ and -- for comments)
From:       "Peņa,_Botp" <botp () delmonte-phil ! com>
Date:       2005-02-17 3:02:57
Message-ID: 20050217030247.5BD20B61E () mx1 ! delmonte-phil ! com
[Download RAW message or body]


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

//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" (application/octet-stream)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic