views:

468

answers:

4

How many lines of code (LOC) does it take to be considered a large project? How about for just one person writing it?

I know this metric is questionable, but there is a significant difference, for a single developer, between 1k and 10k LOC. I typically use space for readability, especially for SQL statements, and I try to reduce the amount of LOC for maintenance purpose to follow as many best practice as i can.

For example, I created a unified diff of the code I modified today, and it was over 1k LOC (including comments and blank lines). Is "modified LOC" a better metric? I have ~2k LOC, so it's surprising I modified 1k. I guess rewriting counts as both a deletion and addition which doubles the stats.

+2  A: 

A slightly less useless metric - time of compilation.
If your project takes more than... say, 30 minutes to compile, it's large :)

shoosh
In C++ 30 minutes compile time point to a much smaller project then let's say in Delphi.
Ralph Rickenbach
+1  A: 

Using Steve Yegge as the benchmark at the upper range of the scale, let's say that 500k lines of code is (over?) the maximum a single developer can maintain.

More seriously though; I think once you hit 100k LOC you are probably going to want to start looking for re-factorings before extensions to the code.

Note however that one way around this limit is obviously to compartmentalise the code more. If the sum-total of all code consists of two or three large libraries and an application, then combined this may well be more than you could maintain as a single code-base, but as long as each library is nicely self-contained you aren't going to exceed the capacity to understand each part of the solution.

jerryjvl
+1  A: 

In my opinion it also depends on the design of your code - i've worked on projects in the 1-10K loc range, that was so poorly designed, that it felt like a really large project.

But is LOC really an interesting meassure for code? ;-)

MimerPlusPlus
LOC may not be an *absolute* measure of code complexity, but it is a reasonable approximation, especially if you pay more attention to the magnitude than the exact value (1k vs. 10k vs. 100k)
jerryjvl
A: 

Maybe another measurement for this would be the COCOMO measure - even though it is probably as useless as LOC.

A single developer could only do organic projects - "small" teams with "good" experience working with "less than rigid" requirements.

In this case, efford applied in man months are calculated as

2.4 * (kLOC)^1.05

This said, 1kLOC would need 2.52 man month. You can use several factors to refine that, based on product, hardware, personel, and project attributes.

But all we have done now is projected LOC to a time measurement. Here you again have to decide whether a 2-month or 20-month project is considered large.

But as you said, LOC probably is not the right measure to use. Keywords: software metrics, function points, evidence based scheduling, the planing game.

Ralph Rickenbach
kLOC is per 1000 LOC ? i had 1k written in a day then cleaned up and debugged in another 2 days with more additions to bring it up to 1kLOC. This formula seems faulty. My current project is 4kLOC (after cleanup). A specific 500LOC took me 2 weeks to learn and write with tons of gotchas (i hated that one...) so i am unsure how that formula should apply. Does it only apply to lines you have no previous experience with?
acidzombie24
It applies to the development of new projects, but includes all phases of a project. It has been established in 2000, so maybe some productivity has been gained. COCOMO has been calculated through post mortem analysis of many projects. It only applies to teams, not single developers. Good developers are up to 10 times faster than bad ones, so your experience may not apply. One might also take into consideration the definition of LOC: nothing generated, handwritten just statement lines. And of course it depends on the programming language (ASM - C). So both LOC and COCOMO seem rather useless.
Ralph Rickenbach