Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is no correlation between line count and code quality.


I suspect that if someone could come up with a reasonable way to single out confounding variables, there would prove to be an inverse correlation between SLOC per function point and code quality.

My rationales:

- More SLOC means more places for a bug to hide.

- More SLOC means more logic to have to reason about.

- More repetition leads to more SLOC.

- More repetition increases the chance that a bug can be fixed in one spot but not in others.

- More repetition increases the chance for regression bugs resulting from updates not being fully propagated

Anecdotally, on my team it seems that we tend to have the least quality issues in the stuff that's written by folks who produce the most factored code.


- Fewer SLOC means less code to compile and execute.

- Fewer SLOC means more code fits on one page.

- Fewer SLOC means it may be easier to explain/document/remember what it does.



Sure there is, if you control for functionality. You can't solve complex problems concisely without the right abstractions, and the right abstractions are 90% of the battle for code quality.


Is it not likely a bell-curve? IE: Is it not likely that there's a correlation between high line count and average quality?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: