3 ms·
"There is a direct and measurable causal relationship between number of LOC and number of bugs" I don't believe it is a simple linear relationship otherwise we
by arethuza 15y ago
"There is a direct and measurable causal relationship between number of LOC and number of bugs"
I don't believe it is a simple linear relationship otherwise we'd all be using Perl or APL. More likely there is a "sweet spot" in the verbosity/terseness spectrum that is occupied by languages like Python.
- mattdeboard 15y agoWell, I'm not going to carry the banner for the authors' research, but that is not the case they make. According to them, more lines of code = more bugs.
- seabee 15y agoMaybe those Perl one-liners weren't so useless after all...
- sambeau 15y agoI think that the real relationship is between clauses and bugs and in many languages a line equates near 1:1 to a clause. This is not the case for Perl & APL: each line can contain a multitude of clauses and the relationships between them can be complex to unravel. Conversely some languages (e.g. at the extreme end assembly language) require multiple lines to express a complete clause. Complex manually expressed type systems can be similar in effect to both cases. A single line can become complex to unravel e.g this kind of thing: int (*(*vtable)[])(); Reading complex regular expressions also exhibit similar problems in deciphering. Hence in Perl they are often broken over multiple lines with /x. We seem naturally drawn to using lines as logical delimiters: code is maybe similar to poetry in this respect. Also, in similarity to poetry, single clause lines allow us to annotate our thinking on the same line by way of a comment. One clause per line is probably a natural sweet spot. If my theory is correct then the relationship between lines and bugs will still be linear but APL would have a multiplier greater than one while assembly's multiplier could be a fraction (e.g. 5 vs 1/5).
- russell 15y agoIf I had to nominate favorite chapters in a book, it would be the one in the Vax C manual that walked you through translating C declarations into English and English to C. There was also a program that would do the same They saved me from mental meltdown more than once.
- power 15y agoIt could be linear with a different constant multiplier for each language. Perl would presumably have a higher multiplier than Java given its density.
- seabee 15y agoSounds like the kind of scaling tools like CLOC can display. http://cloc.sourceforge.net/ http://cloc.sourceforge.net/