TDD is BS?

Jonathan M Davis jmdavisProg at gmx.com
Wed Jun 19 14:59:05 PDT 2013


On Wednesday, June 19, 2013 22:27:57 Joseph Rushton Wakeling wrote:
> On 06/19/2013 08:58 PM, Jonathan M Davis wrote:
> > Exactly. With TDD, you write the tests and then write the code
> 
> Isn't this what is highlighted in the second article linked to by the OP, as
> being precisely one of the misinterpretations of TDD?

I haven't read the article yet, so I don't know.

> I'm not sure if I've misinterpreted you here, because one needs to
> distinguish between "write all tests first, then code" (which is not what
> TDD means) and the rather tighter iteration/co-evolution of test and code
> writing which is supposed to characterize TDD. If you meant the latter
> then I apologize.

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.

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.

- Jonathan M Davis


More information about the Digitalmars-d mailing list