Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Re: Mock Objects

by theguvnor (Chaplain)
on Apr 12, 2002 at 00:22 UTC ( #158448=note: print w/replies, xml ) Need Help??

in reply to Re: Mock Objects
in thread The Joy of Test

You've just cracked the thought barrier that leads to formal methods. For each chunk of code, you create a list of assertions that impose constraints on what the code should do. Then you go through and make sure your code actually obeys those assertions. Formal methods take the idea a step farther by writing the assertions in mechanically-readable form, then running them through a postulate-matching engine to do the gruntwork of making sure everything checks. ... When you code to the assertions, you find yourself structuring programs so that no given operation can possibly fail. Ususally, you end up with a framework like so: ...

This is cool. Very cool. I admit that I didn't truly grasp your first paragraph at first read, and am still processing it. BUT, with the tutorial/example you gave, I saw the light! I will definitely try this! Thanks mstone - you have cracked my thought barrier, and I am looking forward to eliminating vast multi-level conditionals!!


Update: Thanks again mstone for providing links to (what I'm sure will be) some great resources. And BTW I could not imagine pronouncing 'Z' anything but 'zed'... ; )

Replies are listed 'Best First'.
Re3: Mock Objects
by mstone (Deacon) on Apr 12, 2002 at 17:43 UTC
    I admit that I didn't truly grasp your first paragraph at first read, and am still processing it.


    You should see the forehead-shaped dents in my wall. ;-)

    Really good ideas -- the ones that change the way you think because they change the way you look at things -- take time to absorb. I just happened to find this particular wall before you did.

    One paper you should definitely read before getting too far into the whole business is: What's Wrong With Formal Programming Methods? (PDF, 15 pages, 56K). It's a nice summary of the history and ideas behind formal methods, but doesn't beat you into the ground with impossible-to-type-on-a-regular-keyboard formalisms like the language Z (pronounced 'zed'). It's also a nice antidote to the full-gonzo 'more correct than thou' attitude some formal methods types can acquire.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://158448]
[chacham]: there's a regexp function. if that can be used ina check() constraint...
[LanX]: Thanks, but no check constraints in MySQL :/
LanX 1 ..2 ..3 ..4 .. is erix missing ;-)
LanX is Discipulus reciting "Springtime for Hitler" ?
[choroba]: erix could tell you how to do it in Postgres
[chacham]: wow, mysql really is as bad as i thougt
[choroba]: completion?
[LanX]: That's what he usually does when MySQL is mentioned ;-)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2017-03-30 15:06 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (360 votes). Check out past polls.