4 ms·
Static types most definitely do not replace the need for tests!
by starefossen 8y ago
Static types most definitely do not replace the need for tests!
- asnrk 8y agoYour statement and the one you're responding to are wholly compatible.
- jakelazaroff 8y agoAgreed! They replace the need for specific kinds of unit tests, e.g. making sure your functions accept and return the correct shapes. You still need to test the actual logic, and should be doing some sort of integration test on the application as a whole. In retrospect, my original response was too terse. Static typing and testing serve the same purpose, which is to make sure your application runs according to some measure of correctness. We shouldn't be setting up one-or-the-other dichotomies — we can have both!
- ianwalter 8y agoBut it misses the point I was originally making. I was not suggesting they are mutually exclusive.
- jakelazaroff 8y agoMy interpretation of your point was that unit tests are more valuable than static types, and I don't think that's necessarily true. They're both forms of testing, and it's important to recognize their strengths and weaknesses. Static types won't help with your application logic, but they will (for example) ensure your function inputs and outputs are the correct types, help document your code and ensure consumers call your code correctly. Unit tests can only do the first one, and it's more verbose and brittle.