|
|
|
|
|
by davedx
3187 days ago
|
|
Yes, I think after reading to the end I agree with your summary. I still think there is value in using languages that eliminate entire classes of bugs though, for example using a language that has automatic memory management is a no-brainer except for certain specific domains where you need to do memory management yourself. Likewise with static typing: it eliminates type bugs. There have definitely been times for me recently when working with a dynamic language like JavaScript and there's been a bug in our code base that would not have happened had we been using TypeScript. Some of these bugs also had significant business impacts. There is of course a trade off, typed languages can be more challenging to develop with: I've had a number of fights with the Scala compiler. Typically it's libraries rather than the base language, but it still costs time I wouldn't have spent if using a dynamic language. Also, the Scala compiler itself is very slow, to the point where the XKCD comic about "code's compiling" has been true. On modern Macbook Pros, this shouldn't be a thing anymore, but it still is :) |
|
In practice, it's not so simple. It probably holds for garbage collection (assuming GC is suitable for your application domain), but static type systems come with costs. There's plenty of evidence (via studies) that type annotations are really valuable as documentation, but the argument for bug prevention is less clear. Most bugs that are caught by static type systems are also generally prevented by other approaches (because they're basically clerical errors that you hit fast even during basic testing). Conversely, there are plenty of real bugs that aren't caught by type systems (or only by type systems that are essentially full-fledged specification languages, or by putting lots of work into types).
While there's a huge difference between having a validation strategy for your code and not having a validation strategy at all (or winging it), it's much more difficult to assess the relative value of different validation strategies, especially once you take costs into account.