3 ms·
A BigBallOfStuff type should stick out like a sore thumb in a code review, though. Static typing is a DSL for specifying assumptions in a way the compiler can
by silentbicycle 16y ago
A BigBallOfStuff type should stick out like a sore thumb in a code review, though.
Static typing is a DSL for specifying assumptions in a way the compiler can check. If you misuse it, it can backfire, but that's true of pretty much everything.
- msbarnett 16y agoThat's just a recasting of "if you rigorously specify all of your assumptions in your unit tests, you needn't worry about anything". You can take maximal advantage of the type system to encode assumptions, but it's still on you to do it. This isn't a silver bullet that makes static typing better than dynamic typing, because nothing forces you to be competent about specifying your assumptions here, either. You can take maximal advantage of the type system to specify as many assumptions as it can check or you can take maximal advantage of the unit tests to specify the same assumptions. You end up in the same place either way, and the OP's claim that you can "trust" the existence of passing type-checks without looking at the types to see what assumptions they encode in a way that you cannot trust unit tests doesn't hold up.
- silentbicycle 16y agoAgreed. I think some mix of declarations and automated (regression, etc.) testing is probably most practical. I like randomized testing, as well.