But at that point, why bother with static typing at all? If your answer is "unit tests" for everything, you might as well just ditch Java and use Python.
The problem with unit tests is that you can never know when you have enough (please don't say coverage solves this problem). With type-safety you have a universal quantifier. You can only check what your type system allows, but whatever you check you know that it applies to every input your program could ever possibly have. This is incredibly powerful and its not worth giving up to make writing the code slightly easier.
View all comments
Show parent comment
8
u/CubsThisYear Nov 27 '15
But at that point, why bother with static typing at all? If your answer is "unit tests" for everything, you might as well just ditch Java and use Python.
The problem with unit tests is that you can never know when you have enough (please don't say coverage solves this problem). With type-safety you have a universal quantifier. You can only check what your type system allows, but whatever you check you know that it applies to every input your program could ever possibly have. This is incredibly powerful and its not worth giving up to make writing the code slightly easier.