[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Posted Jim Weirich OSCON 2006 video presentation

Trans

2/6/2007 11:18:00 PM



On Feb 6, 4:14 pm, "Diego Scataglini" <dwebsub...@gmail.com> wrote:
> For anybody interested, I posted the talk about Design By Contract in Ruby
> that Jim Weirich gave @ OSCON 2006 on my blog.http://jroller.com/page/dscataglini/?anchor=jim_weirich_tes......
>
> I have 3 or 4 more that I am in the process of uploading.
> I am waiting for a written release from some of the presenters :) before I
> make them public.
> Last thing I need is to get sued :D

Interesting presentation.

The more these test/specification/dbc system evolve the more they seem
like double-entry bookkeeping. Aren't we just writing the code twice
but from two differnt perspectives and seeing if they match up?

T.


4 Answers

Devin Mullins

2/6/2007 11:35:00 PM

0

Trans wrote:
> The more these test/specification/dbc system evolve the more they seem
> like double-entry bookkeeping. Aren't we just writing the code twice
> but from two differnt perspectives and seeing if they match up?
Mostly, yes. (Though usually the test is a drastic simplification for a
specific example.) Thrice if you do acceptance testing. Is that a bad thing?

Devin

Trans

2/7/2007 5:29:00 AM

0



On Feb 6, 11:18 pm, "Diego Scataglini" <dwebsub...@gmail.com> wrote:
> I believe one of the main differences is that DBC is more of a runtime
> check.

Perhaps. But one of the first thing I thought when I saw Jim run it is
where's the "--debug"? I don't see why you'd want this to happen in
production.

T.


Adrian Howard

2/7/2007 9:56:00 AM

0

On 7 Feb 2007, at 05:28, Trans wrote:
> On Feb 6, 11:18 pm, "Diego Scataglini" <dwebsub...@gmail.com> wrote:
>> I believe one of the main differences is that DBC is more of a
>> runtime
>> check.
>
> Perhaps. But one of the first thing I thought when I saw Jim run it is
> where's the "--debug"? I don't see why you'd want this to happen in
> production.

I've not watched the presentation, but with experience of other DBC
systems I imagine the reason would be that contract violations can
happen in production - and knowing about them is generally a good
thing :)

Cheers,

Adrian

Faisal N Jawdat

2/8/2007 6:59:00 PM

0

On Feb 6, 2007, at 6:18 PM, Trans wrote:
> The more these test/specification/dbc system evolve the more they seem
> like double-entry bookkeeping. Aren't we just writing the code twice
> but from two differnt perspectives and seeing if they match up?

Given that double-entry bookkeeping is often cited as one of the
subtle advancements that led to global the dominance of the Western
world, I'm not sure this is a bad thing.

But.

"Yes and no". For a single piece of code, it's generally a lot
simpler to test that the code did the right thing than to write the
functional code itself. If you add in edge cases, the problem
multiplies: it's a lot easier to write 10 individual test cases,
each for one edge case, than to write one piece of functional code
that elegantly (or even inelegantly) handles all the edge cases. As
your app grows, this aspect grows by leaps and bounds.

I've been asked something along the lines of "well how do we know
that the test code doesn't have bugs in it?". The answer is that we
don't. However, think of this as a probability problem. The
following are gross oversimplifications, but should get the gist.

- If you have one test case per chunk of code, and that test case
also has a 10% chance of being wrong, and if they're wrong in exactly
the same way, then you have an 81% chance that the code executes
correctly and tests cleanly, an 18% chance that the test fails (9%
false positive, 9% false negative), and a 1% chance that the test
passes incorrectly. Since a failure will likely to look through your
code until you either find what's wrong in your code or your test,
then you've just dramatically decreased the chance of an uncaught bug.

- As code increases the likelyhood of bug-free code decreases
exponentially with the amount of code. However, since tests often
must implicitly test things other than the specific thing they're
testing, the likelihood of bugs remaining uncaught also decreases at
an exponential rate.

There are limits to all of this, and I do think that people are prone
to putting too much faith in automated testing, but it still runs
circles around a lack of it.

-faisal