3 ms·
As with all things, truth is somewhere in the middle. I've found that unit tests do help me write better code and find corner cases which I would otherwise miss
by jwr 16y ago
As with all things, truth is somewhere in the middle. I've found that unit tests do help me write better code and find corner cases which I would otherwise miss. But I don't treat them as a religion, and I don't write them for every function.
Just don't overdo either way and you'll be fine.
- arethuza 16y agoBut people really don't want that kind of sensible mature argument and would rather have set of "best practices" that they can blindly follow.
- abp 16y agoYes, but only if one got zero or not much experience in the field. So actually you are saying something that is true for everything.
- arethuza 16y agoYou'd be amazed at the number of experienced developers who tell me "it is best practice to do XYZ" who when challenged as to what is the underlying justification for this recommendation can't actually provide a sensible answer.
- crististm 16y agoI've tried TDD for one project and it gave me a nice feeling of having a safety net. It was a good feeling. The problems started to appear when the project increased in complexity and needed a redesign in some of it's parts. I had to do _again_ twice the work to have the tests match the code behavior. The article mentions this problem too. The benefit of the tests disappear when your code changes beyond refactoring.
- allend 16y agoThen why didn't you drop the tests if you think there was no benefit?