4 ms·
>Can't tell if you are being serious here. That's just not true at all; it's well known that LOC is a poor indicator of bug occurrence. I looked for the refere
by SomeCallMeTim 14y ago
>Can't tell if you are being serious here. That's just not true at all; it's well known that LOC is a poor indicator of bug occurrence.
I looked for the reference but couldn't find it, but there was a meta-study of lots of different papers claiming that this or that new programming methodology would reduce the number of bugs in code, and the meta-study came to the conclusion that, in fact, if you just count the lines of code in similar implementations, you find a correlation between LOC and number of bugs that explains all of the claimed methodological improvements.
So yes, fewer LOC (for implementing a particular problem) IS a good indication you will have fewer bugs.
I didn't find the reference, but I thought it would simply be obvious that if it took many more LOC that there would be more opportunities for a bug to hide out.
Your reply to another question about LOC seems to indicate that you think I'm making a claim about LOC as a measure of productivity or of absolute # of bugs created per LOC.
This couldn't be further from what I'm saying. I've also taken great happiness out of deleting lines of code -- especially other people's code ;) -- and so measuring productivity in LOC is insane. At the same time, can't you see that if I delete 10000 LOC, then I've deleted a huge number of potential bugs in all that deleted code? I've CERTAINLY reduced the maintenance costs of the code, no matter how you slice it.
I'm also not talking about comparing MY code to anyone else's, but rather how many bugs I'm going to write if I have to write 400 lines of code in Java vs. 40 lines in Lua, and I am going to tell you right now that it's far less likely I'll write a bug in those 40 lines of Lua -- I almost don't care what a study alleges, I'd need iron-clad proof with REALLY specific results before I'd believe otherwise. It's pretty obvious to me that there are fewer chances to make a mistake, static analysis in Java notwithstanding.
And if I do end up with a bug, that looking at those 40 lines on one screen it will be easier to see what's happening and FIX the bug than if I have to jump all over the place to see what's happening in 400 lines of code.
And a 10-1 ratio of code size may not always be true, but it does happen. Java is VERY verbose compared to Lua.