Search code examples
analyticscode-metrics

What does number of lines of code tell you about your application?


Recently, we were asked to find the lines of code in our application by our managers. I have actually been pondering since then; what does this metric signify ?

  1. Is it to measure the average lines of code the developer has written over the time ?

    • IF no re-factoring happens then this can be a possibility.
  2. Does it tell how good is your application ?

  3. Does it help one in marketing the product ?

I don't know how does it help. Can some one please guide me in the right direction or answer what does this metric signify ?

Thanks.

Something I found recently http://folklore.org/StoryView.py?project=Macintosh&story=Negative_2000_Lines_Of_Code.txt&sub=HN0


Solution

  • The number of lines of code is a popular but a problematic metrics.

    Advantages

    1. Number of lines of code shows a moderate (0.4-0.5) correlation with the number of bugs [Rosenberg 1997, Zhang 2009], i.e., larger modules usually have more bugs, and which might be more interesting, more bugs per line [Fenton and Ohlsson 2000, Zhang 2009]. I would like to stress that there are better (but more complex) ways to predict the number of bugs.
    2. Number of lines of code can be used to predict the development effort, i.e., there are effort prediction models (e.g., COCOMO) that take the number of source lines of code as one of the input parameters.
    3. Some of the more complex OO-metrics show strong correlation with class size [El Emam et al. 2001].

    Disadvantages

    1. Using lines of code as a productivity measure is extremely problematic since it becomes difficult to compare modules in different languages or written by different developers. Indeed, some languages are more verbose due to, e.g., presence/absence of “built-in” functionality or structural verbosity (e.g., .h in C). Moreover, as already mentioned above, some developers are paid per line of code which necessarily leads to ridiculously complicated code. Finally, code generation should be taken into account.
    2. While "lines of code" is a common metrics, one has to be careful with distinguishing different kinds of "lines of code": with blank lines or without, with comments or without, counting logical statements of physical lines...