Hacker News new | past | comments | ask | show | jobs | submit login

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.




But people really don't want that kind of sensible mature argument and would rather have set of "best practices" that they can blindly follow.


Yes, but only if one got zero or not much experience in the field. So actually you are saying something that is true for everything.


You'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.


I'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.


Then why didn't you drop the tests if you think there was no benefit?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: