Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Does anybody write tests first?

by moritz (Cardinal)
on Feb 22, 2008 at 14:56 UTC ( [id://669573]=note: print w/replies, xml ) Need Help??


in reply to Re: Does anybody write tests first?
in thread Does anybody write tests first?

Before learning Perl I wrote some software in Eiffel, and they had that "Design by Contract" paradigm very early, and I used it extensively.

It helped, but it didn't replaced tests.

Why? Because the code has to be run in order to check these precoditions, postconditions, class invariants etc.

And if a method isn't called during testing, all your assertions are vain.

I ended up rerunning the application all over just to make sure these assertions were executed and checked. But the test suite should have done that, not me manually.

There's nothing wrong with DBC (and I like the fact that Perl 6 will come with it by default), but it's just not enough.

Replies are listed 'Best First'.
Re^3: Does anybody write tests first?
by educated_foo (Vicar) on Feb 22, 2008 at 15:07 UTC
    And if the code (or "method" -- I need to get my OOOrthodoxy checked) isn't called when you use the program, it probably doesn't matter. If you're writing code you don't use, you've got a more serious problem.
      If code isn't called when you routinely use the program, you won't initially find the bug. When the rare case or corner case occurs, though, it'll be a pain in the rear to track that bug down.
      Let's just hope you never have to write a script that does X on weekdays or Y on the weekend, but Z if the date is February 29th ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://669573]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-03-28 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found