3 ms·
> It's just madness. You don't want to type `string` or `int`. It really is as simple as that. Correct! I don't want to type it and, more importantly, I don't
by bjourne 5y ago
> It's just madness. You don't want to type `string` or `int`. It really is as simple as that.
Correct! I don't want to type it and, more importantly, I don't want to force others reviewing my code to have to read it. One of the very few empirically demonstrated facts about software engineering is that the number of defects is proportional to size of code, usually measured as the number of lines of code. Source: https://softwareengineering.stackexchange.com/questions/185660/is-the-average-number-of-bugs-per-loc-the-same-for-different-programming-languag https://softwareengineering.stackexchange.com/questions/1856...
There's a lot of bullshit in software engineering, cargo cults, buzz words, bla bla oriented programming, etc. All with zero empirical evidence. But that the number of bugs per line of code remain roughly the same independent of language has actually been demonstrated.
Thus, I pick Python over more verbose statically typed languages.
- watwut 5y ago> I don't want to force others reviewing my code to have to read it. Having it written there makes code review easier instead of harder. Because you see information instantly instead of having to guess it.
- arduinomancer 5y ago> One of the very few empirically demonstrated facts about software engineering is that the number of defects is proportional to size of code I think you're taking that too literally. It doesn't make sense applied to types. If you have the same piece of code, having types doesn't increase the complexity in any way. Its just more information shown and more validation. By that logic we should all use the shortest variable/function names possible so that we can minimize the length/lines of code
- bjourne 5y agoOf course it makes sense. Researchers have found a positive correlation between code size and number of defects. Type declarations increases code size. > By that logic we should all use the shortest variable/function names possible so that we can minimize the length/lines of code Perhaps we should since there is no research to suggest that short names negatively affect software quality.
- StevePerkins 5y agoIf you follow anything vaguely resembling PEP8 (i.e. max line length of 79 characters), then your Python code probably has 2x to 3x or more the number of lines that it should. To then turn around, and claim that type declarations inappropriately inflate the line count, is absurd.