4 ms·
You don’t really need tests for everything. If you make the invalid state unrepresentable in the type system then, guess what? You don’t need to test for its va
by tigershark 8y ago
You don’t really need tests for everything.
If you make the invalid state unrepresentable in the type system then, guess what? You don’t need to test for its validity and more importantly you are guaranteed that if it compiles it can’t ever reach an invalid state.
This renders a whole class of tests unnecessary.
- vidarh 8y agoWhile that is true, you still need to test to ensure that your representation matches reality, and in practice when you do that in systems written in dynamic languages you tend to cover most type issues implicitly. For that matter it's not that hard to write code to statically validate that arguments to a given method are checked against a set of types and that this set does not include a representation of invalid values. (E.g. I can "forcibly" wrap any method with checks). The reason the various libraries to do that haven't gained much traction is that they've rarely paid for themselves in reduced effort compared to higher level tests. I'm all for more static validation, but I just don't think we have suitable tooling yet to do it at a level that provides sufficient benefit.