4 ms·
One thing I've noticed is that a strong type system does force me to think harder about interfaces. Sure, you can think just as hard about interfaces without s
by mjw 16y ago
One thing I've noticed is that a strong type system does force me to think harder about interfaces.
Sure, you can think just as hard about interfaces without static typing. But speaking personally as someone who does mostly Ruby but is building increasingly complex infrastructure in Ruby and trying to break things up sanely -- it helps me to think clearly when I prototype the interfaces and the types in a statically typed language like Scala.
Surely it's meant to be the other way around? But an interesting realisation for me.
On the other hand, there's that feeling of code which does exactly what it needs to do to pass the tests, nothing more, nothing less. Which while very economical and very suited to rapid development, often doesn't stand up in its own right as a respectable design without regular and very disciplined "and now I go back and refactor" steps. Often those steps correspond (to my way of thinking) with going back and thinking deeper about the types and the interfaces.
So, I think types are more than just a limited kind of testing which happens to run statically - they also give you a conceptual framework and structure, in the mathematical as well as the regular sense of the word. An ontology, if that's not too grand a word for it. And as such they can help shape your design and spur you into phrasing your design clearly. Despite occasionally getting in the way of it.