Re:The maintainability of unit tests
by silentbicycle on Thursday February 25, 2010 @12:54PM
(#1151108)
Right. The tests come from the same mind(s) that wrote the code. Some kinds of bugs won't occur to them at the time, and may also be missed by the corresponding tests.
Testing upfront is just another tool, whether by unit tests, static typechecking, or a REPL. Often useful, but not a panacea.
On one side, TDD made sure that your code is designed to be testable at maximum level. That means: developers have no excuses to design their code to be testable (whether it uses DI, less coupling, or whatnot).
One thing about developers is that they're too self-confident that their code is not buggy. When bugs found, they just fixed it and didn't bother to analyze and learn from mistakes.
So what happened when they wrote untestable code and suddenly 2 weeks later there were bugs manifest due to whatever reasons? If the untestable code is easy to refactor, management probably won't mind a bit of hickup in their schedule. But if it takes a wee bit more time?
I think TDD is good when the developers are inexperienced. But at the same time, it's human nature to be lazy and made mistakes (or underestimate things).
I don't know the best answer whether TDD is good or not.