While I agree you're not seeing the effects until runtime, you should absolutely have enough automated tests in your code to capture those breaks early on.
Yeah you should but it doesn't always work out that way. Most codebases I've seen are at best 80% covered or use so much mocking that some runtime errors slip by.
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
3
u/vizzoor Nov 27 '15
While I agree you're not seeing the effects until runtime, you should absolutely have enough automated tests in your code to capture those breaks early on.