3 ms·
The point is that a whole class of things that you would have to write unit tests for, you get "for free" with strong typing, and for a lot of the others, there
by gaius 15y ago
The point is that a whole class of things that you would have to write unit tests for, you get "for free" with strong typing, and for a lot of the others, there's QuickCheck. Or as the old saying goes, why get a dog and bark yourself?
- vidarh 15y agoExcept you don't get them "for free". You get them in the form a ton of restrictions on you that you need to be mindful of when writing it in the first place. You just pay for it in different ways. The biggest difference is that in dynamic languages, you can sometimes get away with being lazy and not writing the tests to verify the things static languages enforce to varying degrees (whether or not that's a good thing is another issue).
- SkyMarshal 15y agoHaskell frontloads type considerations and tests via a required, tightly-coupled type system. Dynamic languages backload them via optional testing. In either case you still have to think about those issues when correctness is a requirement. When it isn't (ad-hoc analysis, prototyping), dynamic languages are more pleasant to work with. When it is a requirement, Haskell is uniquely powerful. Problem is, many projects are subject to both requirements at the different times. Exploratory at the start, strict once the problem to be solved is identified. Know the tradeoffs and pick your poison.
- nightski 15y agoWho wants to explore errors? Seriously a well designed array library would not limit exploration at all while preventing one from wasting time with trivial mistakes.