4 ms·
Nowadays I write unit tests for any nontrivial code I create. It takes a little more time than writing type declarations, but IMHO they offer much more value.
by danmaz74 7y ago
Nowadays I write unit tests for any nontrivial code I create. It takes a little more time than writing type declarations, but IMHO they offer much more value.
- tptacek 7y agoUnit tests are great, but they're a stupid way to catch typos.
- dragonwriter 7y ago> Unit tests are great, but they're a stupid way to catch typos. Catching typos is an important part of what unit tests do with statically typed code, since typos result in value errors at least as often as type errors.
- tptacek 7y agoThat’s obviously true, but it’s equally obvious that there’s a whole (large) class of typos that types eliminate.
- danmaz74 7y agoI agree that writing them only to catch typos would be stupid. But if you're going to write them regardless, catching typos comes for free. Ps and luckily, even with dynamic languages any decent IDE will catch most typos