[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: case against XP (was: PG: Hackers and Painters)
Jerry Jackson wrote:
> It's certainly the case that some kinds of programs are more difficult
> to test than others. However, I find the assertion that it's impossible
> to get good coverage a little strong. People do use carefully chosen
> edge cases. In fact, one of the interesting aspects of the TDD approach
> is the deliberate, ongoing attempt to break the program. Every test
> iteration starts with the thought: "How can I break this program now?".
> If I can come up with a way, I write a test and demonstrate that the
> program breaks. Then I fix it and try again. Eventually you run out
> of ways to break the program. This runs entirely counter to the way
> I believe most people think about their programs. Most people tend to
> think about the "happy path" nearly all the time and only later (if then)
> wonder about how things might go wrong. (Note that I'm not talking
> about checking error return codes, etc. -- I'm speaking more at the
> functional level).
>
> I think that this deliberate focus on how to break the code
> is one of the most important aspects of TDD.
Excellent explanation. And this is the reason why I personally think
that unit testing is more powerful than design by contract - DBC makes
you only think about the "happy paths"...
Pascal
--
Pascal Costanza University of Bonn
mailto:costanza@web.de Institute of Computer Science III
http://www.pascalcostanza.de Römerstr. 164, D-53117 Bonn (Germany)