DEV Community

Discussion on: Is TDD the Savior?

Collapse
 
stereobooster profile image
stereobooster

There is no empirical evidence that TDD improving quality (there are researches which say that there is an improvement but it is hard to say if it is due to TDD or due to other factors, like bigger time spent on development). See this talk.

TDD is not the only technique in the field, for example, there is type driven development when you write types first and then write code.

There are situations when TDD doesn't make sense, for example, when you prototype something: you want to create UI to test it's UX, and you have no idea if it is good or not, and it would take you more time to explain it with whiteboard than to write code. Following TDD, in this case, can be a total waste of time, because those prototypes rarely pass as is (at least in my experience).

There are cases when TDD is ideal - when you write a library and the problem is well understood. For example, you want to write a sort algorithm - it has been solved for a million times. You can write tests first and even more, you can write benchmarks as well.