Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Our manager has asked for a report on on the number of lines of code in our software.

What should we do?

share|improve this question

closed as not constructive by Walter, Ryathal, FrustratedWithFormsDesigner, Bryan Oakley, Otávio Décio Jun 12 '12 at 15:29

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Maybe you should give the reason for this request. –  Jason Holland Jun 12 '12 at 15:14
    
What kind of project is it? LoC might be a somewhat useful metric for some projects and counterproductive for others. –  jfrankcarr Jun 12 '12 at 15:15
1  
@marvc1 - If your manager wants to waste your time creating the reports then that is his/her choice. Do exactly what he/she wants. Your manager could easily do this themselfs they just want somebody else to do it. –  Ramhound Jun 12 '12 at 15:27
1  
Find out why the report is being asked. Is it building history for estimations in the future? Is it from some C_O that wants some numbers? Is it just curiosity? –  MichaelT Jun 12 '12 at 16:16
6  
Tell her the numbers, then add the Qt library as part of your source tree and next month show her how productive you all can be... –  thorsten müller Jun 12 '12 at 16:30

6 Answers 6

up vote 10 down vote accepted

To quote Bill Gates :

Measuring programming progress by lines of code is like measuring aircraft building progress by weight.

You should explain to your manager that Lines Of Code can go up and down after bug fix, factorisation, optimisation, and does not indicate if :

  1. work is done
  2. software has a good quality

Besides, the same code can be written in a single line of code or four, and mean the same thing for example :

if (x > 0) print("positive"); else if (x < 0) print("negative"); else print("nul");

if (x > 0) 
{
    print("positive");
} 
else 
{
    if (x < 0) 
    {
        print("negative");
    } 
    else
    {
        print("nul");
    }
}
share|improve this answer
  1. Create the report
  2. Read this Dilbert
  3. Realize the futility of explaining how software works to a manager
  4. Send report
share|improve this answer

In JavaScript, Thomas Fuchs (scriptaculous) promotes no more than 100 lines of code to allow for succinct and concise modularity.

However, this code is then minified, combined, and zipped. So, lines of code is less of a valid indicator at runtime.

One valuable realization for lines of code is to determine Modularity of code. Which is important.

Hope this helps. All the best! Nash

share|improve this answer

Create the report? Its not exactly an unreasonable demand.

share|improve this answer

Why would you quit over this? LOC isn't always a useful metric for things like productivity, but it can still be useful for judging project size/complexity. Just be clear about what LOC counts say (and more importantly, don't say) about a project and it's progress.

share|improve this answer
2  
Ok, maybe quitting was a little over the top! –  marvc1 Jun 12 '12 at 15:21
    
The question mentions nothing about quitting (at the time I write this). Are you trying to respond to some other answer that may or may not precede yours on the page? Or did the original question mention quitting, which has subsequently been removed? –  Bryan Oakley Jun 12 '12 at 15:30
    
@BryanOakley, Take a look at the edit history of the question. –  Jeremy Heiler Jun 12 '12 at 15:32
    
@BryanOakley The original question was modified since it was posted. –  Oleksi Jun 12 '12 at 15:32
    
+1 Context can definitely make it more meaningful when comparing apples to apples and/or oranges since some frameworks generate a lot of code upfront which could end up in the LOC count. Not that I really think LOC is a good metric for software...but like all things context adds value. –  Rig Jun 12 '12 at 16:16

Get him mad:

During the first iterations, write verbose code with many copy-paste. Then during the next iteration, factor all that code in a single function.

When my manager got a report with a decreasing LOC report, he soon gave up with silly progress indicators.

share|improve this answer
    
Making one's superior mad is not really a responsible nor productive method. Although what Dilbert's strips tend to say, managers aren't all stupid monkeys. –  XGouchet Jun 13 '12 at 10:25
1  
@XGouchet - Teaching a superior to upgrade from micromanager to manager is surely responsible and productive. At least, it was on the project I'm thinking of. –  mouviciel Jun 13 '12 at 11:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.