2 ms·
This. It's not that tests have no benefit -- they do, especially for complex refactoring (though even for that, as you say, tests are rarely exhaustive enough t
by wenc 6y ago
This. It's not that tests have no benefit -- they do, especially for complex refactoring (though even for that, as you say, tests are rarely exhaustive enough to engender full trust).
But outside of the narrow confines of production programming, it's rare that the requirements can be specified completely up-front.
In the initial stages of development, coding is very much a discovery process. Code is often evolved rapidly and drastically, such that any test written is a throwaway. And some of these tests/mocks aren't easy to generate. In data intensive applications, it's especially a chore to have to generate new mock database objects each time the code changes, and with completely different data characteristics to boot (in order to test different facts of the code).
The psychological tedium of doing this will put off most developers. The potential drag on productivity extends to more than just the time required to write test + code: the whole pace will feel sluggish and the dev is liable to feel demotivated.
I see tests being more useful as a retrospective addition, once the code has stabilized and the use-patterns established.
- lmilcin 6y agoThat is good point. In my initial stages I like to explore the problem and tests just get in the way of being able to refactor everything very quickly. Maybe I want to put some dirty implementation first and then once I think I understand the problem better quickly fix it? Maybe I want to start refactoring it without knowing where it exactly will lead me? The problem is tests do not help with these initial stages, they only help if you know exactly what you are doing. And once I am done with the initial stage I want to move to another problem. I don't like sticking with the same module to now do the documentation, tests, etc. Once something works and I am satisfied I move on.