4 ms·
Ad-hoc polymorphism (traits/type classes) and parametric polymorphism (generics) largely solves this, whilst giving you a high degree of confidence that your co
by bjz_ 11y ago
Ad-hoc polymorphism (traits/type classes) and parametric polymorphism (generics) largely solves this, whilst giving you a high degree of confidence that your code correct at compile time.
I've found code written in a duck-typed style brittle and hard to refactor safely - it's very easy to try to restructure something, then find out down the line that something blows up because of some incorrect assumptions in another part of the codebase. You can try to grep for all the method usages, but that is a laborious, error prone process in codebases that are sufficiently large enough.