DEV Community

Discussion on: The broken promise of static typing

Collapse
 
danlebrero profile image
Dan Lebrero

Are you suggesting that Java and C++ devs are super duper proactive? :)

The approach is naive, but I was really expecting that there was going to be some significant difference between "properly" types languages and the rest.

The best explanation that I have found so far is from Bartosz Milewski. Except from his book Category Theory for Programmers

"Strong static typing is often used as an excuse for not testing the code [...] The result of this cavalier attitude is that in several studies Haskell didn’t come as strongly ahead of the pack in code quality as one would expect."

So maybe strong static typing plus proper testing is the answer to less bugs.

What do you think?

Collapse
 
cartermp profile image
Phillip Carter

I'm not suggesting that some groups are more proactive than others - just offering a question that one could draw from that data. Put differently, what if Clojure developers were less annoyed by bugs than C++ developers? I see that conclusion as just as valid as those you've drawn.

I agree that static typing is not an excuse for tests (even though many folks in the FP community wold say otherwise...). Types can certainly eliminate a class of problems if used well, but they're certainly not a silver bullet. Tests guard against change. For any decently-sized project, you need tests to protect your code against yourself :).

Thread Thread
 
danlebrero profile image
Dan Lebrero

"you need tests to protect your code against yourself" -> that made me laugh!