3 ms·
The process of learning to TDD well makes a person code better, regardless of actually doing it. TDD is one of the few actual disciplines I know of around codi
by Glide 14y ago
The process of learning to TDD well makes a person code better, regardless of actually doing it.
TDD is one of the few actual disciplines I know of around coding that can't be just glossed over or faked. One either does or does not. This is doubly true in a pair programming environment. Not using one of the established patterns? One can argue around that. Not doing TDD? Justification usually has to tie with UI in some way.
- mnarayan01 14y ago> TDD is one of the few actual disciplines I know of around coding that can't be just glossed over or faked. TDD is trivially easy to fake. Perhaps worse, it's trivially easy to think you're doing it, when you're actually doing nothing constructive.
- philwelch 14y agoHow do you know whether I wrote the tests first by looking at my code?
- mattgreenrocks 14y agoTDD'd code is generally better designed.
- jdlshore 14y agoThe 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.