3 ms·
His argument is basically that with tight coupling, TDD is too hard and time consuming to pay off. But part of the point of TDD is ensure that all code is test
by alkonaut 9y ago
His argument is basically that with tight coupling, TDD is too hard and time consuming to pay off.
But part of the point of TDD is ensure that all code is testable, and testable means loosely coupled.
So you can't start TDD'ing on a bad and tightly coupled legacy codebase. You can do it on a greenfield project however. Greenfield is very much the "lab environment" he talks about. You control everything.
With greenfield projects comes another reality though: you often have to explore and sketch a lot. TDD does not work well for writing a dozen sketch solutions to something and throwing out eleven.
And that to me is the main drawback of TDD: it works poorly for very young code bases and it works poorly for very old ones (that weren't loosely coupled to begin with). It's a very narrow window where you can start using TDD in a codebase and that's when the architecture is first set, but the codebase hasn't yet grown too coupled. Such a narrow window means it's not very popular, for good reason.