News for hackers. Stuff that matters.
Re:Tom Pinckney: Why I gave up on Java and switched to Python by arethuza on Wednesday August 03, 2011 @09:03AM (#2840953)
"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.

Re:Tom Pinckney: Why I gave up on Java and switched to Python by sambeau on Wednesday August 03, 2011 @09:41AM (#2841081)
I 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).

Re:Tom Pinckney: Why I gave up on Java and switched to Python by russell on Wednesday August 03, 2011 @03:48PM (#2842703)
If 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.
Re:Tom Pinckney: Why I gave up on Java and switched to Python by mattdeboard on Wednesday August 03, 2011 @09:08AM (#2840969)
Well, 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.
Re:Tom Pinckney: Why I gave up on Java and switched to Python by seabee on Wednesday August 03, 2011 @09:52AM (#2841121)
Maybe those Perl one-liners weren't so useless after all...
Re:Tom Pinckney: Why I gave up on Java and switched to Python by power on Wednesday August 03, 2011 @09:42AM (#2841089)
It could be linear with a different constant multiplier for each language. Perl would presumably have a higher multiplier than Java given its density.
Re:Tom Pinckney: Why I gave up on Java and switched to Python by seabee on Wednesday August 03, 2011 @09:55AM (#2841131)
Sounds like the kind of scaling tools like CLOC can display.

http://cloc.sourceforge.net/