Saturday, May 13, 2006

Lines of Code (LOC) Review Questions

My team was asked to do a source code review of a large application. This is actually the third (or probably mode) time we are doing a source code analysis. Our past experience was with smaller code. This time the code is around 2.5 million lines. Now, time for some questions.

How many lines can a good programmer/source code reviewer read in a day?
Is there a rule of thumb / best practice on this?

What is usually the portion of actual code compared to comments (and other non-executing component)? We were joking predicted that the number of actual codes that we have to review is probably only 5oo thousands lines. The 2 million lines were mostly comments and documentation. :D That would be nice.

To be frankly I don't like the LOC approach, but that's the only measure we can use. Is there other measurements? We had a discussion before and came up with some ideas, such as as the number of modules or functions. But they still depend on the size of the modules which could vary.

Now let's talk about the use of tools to generate code automatically. In our case, all of the codes were generated by hand, but there will be cases where the codes were actually generated from (GUI-based) tools. For this case, LOC approach does not make sense, or does it? What measurement can we use for this case? Number of blocks or elements in the diagram?

What's your opinion on this? Pointers to other resources are appriciated.


Priyadi said...

i think sloccount ( automatically discounts comments and documentation when counting LOC

budi said...

Ok. That tool is useful, but it still supports the notion that Lines of Code (LOC) is a good measurement.

monn said...

google "code metric"

yohanes said...

May be my comment is a bit late

I think it depends on the person, a very good person (like Bu I*** from Informatics Department) could check about 150.000 lines of moderately commented code in just a month. And this is a real world enterprise Java application used by a large company, (and she does a line by line checking for checking bugs and program inconsistencies).

From my experience, i think i could do more than 5000 lines of code in a day.