DEV Community

Discussion on: What were your problems with "real world TDD"?

Collapse
 
tobias_salzmann profile image
Tobias Salzmann

I think TDD is a great tool to work towards a known solution. More specifically, if the general approach is fixed and can easily be split down in smaller chunks.

In contrast, when exploring the solution space of a problem or a new technology, TDD can be more of a distraction. In this case, I prefer working towards a working solution before (!) figuring out how to test it.

Something else that I find important: TDD is especially useful when pairing, since then, it additionally serves as a great communication tool. Sometimes, a test can help to communicate an idea much better than words.

I can't stress enough that TDD is one tool that helps us writing code that's both tested and testable. Nevertheless, the focus should be on the goals, not the process.
Blindly applying TDD can lead to code that's well tested and testable, but hard to reason about, especially if continuous refactoring is neglected.
Understanding what makes up testability and reasonability should be the primary goal for anyone who's learning TDD.

Collapse
 
n_develop profile image
Lars Richter

Hi Tobias,

thanks for your feedback.

I can't stress enough that TDD is one tool that helps us writing code that's
both tested and testable. Nevertheless, the focus should be on the goals, not the process.

That's true. The goals are more valuable than the process. Good statement.

In contrast, when exploring the solution space of a problem or a new technology, TDD can be more of a distraction. In this case, I prefer working towards a working solution before (!) figuring out how to test it.

I don't fully agree here. When it comes to new technologies, I agree. But if I am working towards an unknown solution, I find TDD pretty helpful. Using TDD, I can focus on the requirements and that helps me find a solution.

Understanding what makes up testability and reasonability should be the primary goal for anyone who's learning TDD.

Amen. :-)