On Wednesday, June 19, 2013 10:29:49 H. S. Teoh wrote: > On Wed, Jun 19, 2013 at 04:52:22PM +0200, bearophile wrote: > > irritate: > > >My feelings about TDD changed when I saw that talk explaining TDD > > >in the context of double-entry bookkeeping in accounting > > > > I think the usefulness of the TDD method is greatly different for > > different kinds of code to write. > > > > This is another data point for the discussion: > > http://devgrind.com/2007/04/25/how-to-not-solve-a-sudoku/ > > [...] > > As someone else has pointed out, we need to distinguish between > unit-testing and TDD. > > I love D's built-in unittests. They have singlehandedly improved the > quality of my code by leaps and bounds, just because they're so > convenient to use, and help catch careless mistakes early. > > However, I am skeptical about TDD.
Exactly. With TDD, you write the tests and then write the code, and I personally don't like that approach at all. I write the code; then I write the tests; and then I work on both until the code works with a reasonable amount of testing (which in most cases, I think is 100% with lots of corner cases being tested, but there's plenty of code where you can't reasonably do that). And while that approach involves heavy unit testing, it's not "test-driven" at all. But if you want to do TDD, D certainly allows it. The unit testing facilities in the language enable unit testing, but how you go about writing them is completely up to you. - Jonathan M Davis