3 ms·
A few points from the video: > Which of these languages has the lowest number of defects per line of code? Obviously the language that does the least per line
by continuational 10y ago
A few points from the video:
> Which of these languages has the lowest number of defects per line of code?
Obviously the language that does the least per line of code. This is not a measurement of reliability; it's a measurement of verbosity.
> I looked at a bunch of GitHub issues, and dynamic type errors make up a tiny portion of the total amount of issues.
Is the three exceptions he quoted an exhaustive list of things that static type systems prevent? Obviously not. Writing "My name is " + name won't give you one of those errors if name is null. It will output corrupt data instead. Yet it would be prevented by a modern type system.
> Some study from 2000 that has ancient C++ and pre-generics Java 1.3 as the representatives for static typing.
These are not good representatives for static typing. Java 1.3 didn't even have generics, so absolutely no static type safety for collections. Back then it was basically a dynamically typed language, since you had to use Object and make unsafe downcasts everywhere. And most C++ code uses memory unsafe features like arrays, so it's not really a good example either.
> There's nothing that types can do that tests cannot do.
Uh, types can show the absence of a certain class of errors in your program. Tests cannot; at best, they can show the presence of a bug, but only when you suspect that such a bug may be present, and proceed to write a specific test for it.
> Is agility more important than reliability?
If it is, you need refactoring. Types help you refactor with confidence. If you write tests instead, you'll have to refactor (and often rewrite) the tests.
If it isn't, well, then types are designed to give you more reliability. Whether they do or not has unfortunately neither been proven nor disproven. The importance of fixing this is about the only thing I can agree with from this talk.
> Horrendous example of a type in C++
Stop using C++ as the representative for static typing. And stop writing extremely complicated types. It's not how type systems are used by most people.