3 ms·
I agree that TDD and unit tests can help you when writing code. But once your code has been written, are all those unit tests still useful? Or do they get in yo
by misja111 9y ago
I agree that TDD and unit tests can help you when writing code. But once your code has been written, are all those unit tests still useful? Or do they get in your way when you do large scale refactoring?
I have seen quite a few codebases with loads of unit tests that might once have been useful, but now were just slowing down development. Many of them should have been thrown away and replaced by a couple of functional tests, however the sunk cost fallacy always kicked in, nobody wanted to throw away all the hours of work that had gone into making them and not to forget the precious code coverage as well.
- circlefavshape 9y ago> nobody wanted to throw away all the hours of work that had gone into making them This is a REALLY common developer attribute that drives me nuts - people don't want to throw away stuff that they put a lot of effort into.
- mdpopescu 9y ago> But once your code has been written, are all those unit tests still useful? The reason for this question is the naming mistake that was made in the beginning. They are not TESTS, they are SPECIFICATIONS. Once your code has been written, are the specifications still useful? Well, duh... unless the business has changed them then yes, they're still useful.