TDD is BS?

qznc qznc at web.de
Wed Jun 19 06:25:24 PDT 2013


On Wednesday, 19 June 2013 at 11:01:05 UTC, Szymon Gatner wrote:
> D is the only language (that I am aware of) that has first 
> class unit testing support. What do you think? Do we really 
> just "mentally masturbate"?

Let us distinguish between "writing tests" and "test-driven 
development".

I am for all for "writing tests" where it makes sense. I do not 
subscribe to 100% test coverage. Sometimes other things have 
higher priority (time-to-market, fun, return-of-investment, 
politics, etc). I consider 100% an ideal, which can be thought 
about from time to time. It is not a good recommendation for 
rookies or best practice.

Test-driven development is an interesting beast. If you listen to 
the inventors, it makes a lot of sense in the scenarios they are 
talking about: Consultant creating or modifying a component in an 
enterprise environment.

Continuous refactoring tries to evenly distribute the technical 
debt, so developers can be moved in and out of the project 
without friction. Without continuous refactoring someone can get 
the fame, while leaving the technical debt to somebody else. Test 
coverage enables continuous refactoring because you can check the 
component in isolation, if your refactoring did not break 
anything. The test-first principle ensures good test coverage. 
Considering this reasoning, TDD can be seen as an approach for 
managing technical debt.


More information about the Digitalmars-d mailing list