|
|
|
|
|
by qwer
3799 days ago
|
|
> You cannot write unit tests for all plausible values sent to your functions. While this is true, static type checks do even less for this problem. Do you even create specific types for value ranges eg IntegerBetweenZeroAnd100? You're in a vast minority if so, and I'd be interested to see how tedious it is to construct all these non-native types everywhere. > If you omit manual type checking in your code or in the respective unit test, you may miss some subtle failure scenarios. There's generally not much that's subtle about a wrong type. If the code is executed at all, it will usually blow up. In my experience, the subtlety comes in the values. > I personally find that type safety cuts down the number of unit tests I write by half I just don't buy this (but then again my team goes for near total coverage). Nowhere near 50% of our tests are testing anything that would be solved by static types. |
|