3 ms·
Nope. I pretty much always find it to be counterproductive. Most of programming happens in the exploration phase. That's the real problem solving. You're just
by sloopy543 7y ago
Nope. I pretty much always find it to be counterproductive.
Most of programming happens in the exploration phase. That's the real problem solving. You're just trying things and seeing if some api gives you what you want or works as you might expect. You have no idea which functions to call or what classes to use, etc.
If you write the tests before you do the exploration, you're saying you know what you're going to find in that exploration.
Nobody knows the future. You can waste a crazy amount of time pretending you do.
- JustSomeNobody 7y ago> Be prepared to throw one away. You will anyway. Write a POC to learn then you can write tests first for production.
- AdrianB1 7y agoYou are right, but technically speaking you already did implementation for POC without having the tests. So the full answer is "do POC without tests first, continue implementation with tests first".
- EpicEng 7y agoSo, in other words... an "exploration phase" which is done prior to writing tests?
- xkcdfan001 7y agoYour code probably looks terrible because you didn't think about the API before hand you just wrote methods you think a programmer will find useful but you didn't even try them. Hey here's a new concept for you "mocking". Learn to test this thread is pathetic man!
- kragen 7y ago> You're just trying things and seeing if some api gives you what you want or works as you might expect. I don't do most of my programming this way, because mostly I'm writing new things, not gluing together existing APIs with a tiny amount of simple glue code. But when I do need to characterize existing APIs, I find that unit tests are a really helpful way to do it — especially in languages without REPLs, but even in languages that do have REPLs, because the tests allow me to change things (parameters, auth keys, versions of Somebody Else's Software) and verify that the beliefs I based my code on are still valid.