4 ms·
The difference is pretty clear in practice. It's much harder to add tests to existing code than it is to TDD it, and it takes a huge amount of self-discipline t
by jdlshore 14y ago
The difference is pretty clear in practice. It's much harder to add tests to existing code than it is to TDD it, and it takes a huge amount of self-discipline to go back and add tests to "finished" code. So, without TDD, you end up with a relatively small number of tests that test a lot of things, whereas TDD (done well) creates a large number of small tests, each testing one very focused thing.
- philwelch 14y agoAs long as I write the tests roughly the same time as the code, it doesn't really matter which I write first. And I always adopt the practice of writing a large number of small tests regardless. Going back and forth is the important part for me, not necessarily writing the tests first. In any kind of setting with shared code, it shouldn't be a matter of self-discipline, it should be a matter of standards and best practice. You shouldn't be integrating any code without test coverage. This is a standard part of how many projects handle pull requests. If you're only accountable to yourself and writing the tests first is the technique that works for you, I can't criticize but you really don't have much to say to programmers in general, either.