TDD is BS?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Jun 19 15:51:42 PDT 2013


On 06/19/2013 10:59 PM, Jonathan M Davis wrote:
> It's not necessarily the case that you write _all_ of the tests and then all 
> of the code, but as I understand it, with TDD, you write a test for a function 
> before you write that function (though both could be written well before other 
> functions and whatever tests go with them). And I completely disagree with the 
> idea of writing a test for a piece of code that doesn't exist yet, even if 
> you're going to write it immediately after writing the test.

My impression has been that in practice, in good TDD environments, it seems to
work in a more co-evolutionary way than that, with code and tests being written
fairly closely together.

I don't carry any particular torch for it, but if you do treat it as a
co-evolutionary process, it dovetails quite nicely with some modern practices in
industrial safety case management (the tradition was, prepare the design, then
prepare the safety case, whereas modern practice is inclining towards developing
the design and the safety case together).

> I _do_ agree with writing the tests fora function as soon as the function is 
> done, in which case, you're likely going to have to do more work on the 
> function, since it'll probably fail the test, and you'll probably improve the 
> tests some more at that point as well. But I completely disagree with writing 
> the test before the code, which is one of the key features of TDD as its 
> always been explained to me.

Well, it occurred to me that with a bit more up-front testing thought, the bug
in RandomSample that we discussed recently might never have happened -- it feels
more like the tests are playing catch-up to the code, rather than the code to
the testable design decisions.


More information about the Digitalmars-d mailing list