Slashdot Mirror


It's Not About Lines of Code

Charles Connell writes: "What makes a programmer highly productive? Is it lines of code per day? Lines of good code? In this article, I examine the concept of software productivity. I look at some of the standard definitions for productivity and show why they are wrong. I then propose a new definition that captures what programming really is about." Read on for Connell's stab at a better way of evaluating the worth of programmer time. CT Originally the contents of an article were here but there was a communication problem resulting in us thinking we were given permission to print the article here. Now that things have been cleared up, we've linked the original article which you can read instead. Sorry about the inconvenience.

35 of 500 comments (clear)

  1. Classical measures of productivity by T5 · · Score: 5, Insightful

    They just don't apply to this art/science. Would Michelangelo's boss have put him to task for square inches/day or pounds of statue/week output?

    1. Re:Classical measures of productivity by Sc00ter · · Score: 5, Insightful
      If I requested a statue of say, myself, I would expect a completion date. He should be able to figure out how long it would take to finish a statue of somebody my size. Equally he should beable to finish a painting of a subject that's been selected prior to him starting his job. Just as a programmer should be able to estimate how to finish a project if he knows what's involved up front. Of course this isn't exact, it's within a few days or weeks, but there should be a ballpark figure, also, changes to the design should be expected to set things back.

    2. Re:Classical measures of productivity by ackthpt · · Score: 4, Funny
      Why programmers get grey hairs:

      "I need you to be great and create something totally fantastic and immensely profitable by Friday, Can you do it?"

      Why programmers consider murder:

      "What's taking you so long? I've already built something just like it in Access."

      Why programmers retire early:

      "We're totally bankrupt, you probably didn't work hard enough. Thank goodness I've got a golden parachute."

      --

      A feeling of having made the same mistake before: Deja Foobar
    3. Re:Classical measures of productivity by ivan256 · · Score: 5, Interesting

      Yeah, that's great, but what manager works like that? No manager would ever say to me "John, how long would this take you?" for a project with a 6 month or 1 year time frame, and then leave me alone for 6 months while I write code. Managers want progress reports and statistical measures to reduce the risk that that they might get fired when the project they're managing fails. That's where the boneheaded requests for the "number of lines of code you've written this week", or "number of bugs you've fixed this week" come from. It's hard to look at an unfinished piece of software and know how it's coming along, but it's easy to look at a painting or a statue that's in progress and see work being done.

    4. Re:Classical measures of productivity by Darth_Burrito · · Score: 5, Insightful

      To: Mike
      Memo: Design Revisions
      We want corporate statue to have the head of a St Bernard and the torso of a gopher. Can you throw in a couple of extra arms while your at? 4 or 5 should be enough. Need to move the schedule up while we're at, investors will be visiting in two weeks and we need something to show them.
      Thanks,
      Management

    5. Re:Classical measures of productivity by Skyshadow · · Score: 4, Funny
      Well, in fairness, there's a good reason why you can't just leave a developer to go on a six month project.

      This is why the iterative development method is useful -- you set a certain number of things you want to see done by such-and-such a date (best done with the interaction of the developer), then if it's not done the developer better have a good reason.

      This approach works on most development projects (with the possible exception of very new projects with no existing product) and only when at least the lower level managers understand the development of the project and can participate in setting the goals.

      Oh, and here's the big secret: then you build on an extra 15 days for every six months of the project and don't tell anyone involved with the development. That way, you look like a hero if it gets done in time and don't lose your job if its not. Don't tell anyone.

      --
      Every year during my review, I just pray the words "slashdot.org" aren't mentioned.
    6. Re:Classical measures of productivity by loydcc · · Score: 5, Insightful
      If I remember the story correctly... The Pope wanted Michelangelo to send his portfolio for consideration before giving him the Sistine Chapel. Michelangelo drew a circle freehand on a slip of paper and sent it off with a courier. The pope was insulted and sent the courier back with an admonition to send a real portfolio. Michelangelo sent the circle back. The pope then traveled to confront Michelangelo. Michelangelo's response was something on the order of the circle is perfect. If he could do better freehand he should do the whole ceiling his own damn self.

      What this has to do with software is sometimes the customer doesn't know what they want. Sometimes management has to trust the artist. And sometimes the amount of work is less important than the quality of work.

  2. could this be possibly be more useless? by nsqtr · · Score: 5, Insightful

    Dude, buy a copy of DeMarco/Lister's "Peopleware", original edition is circa 1985. Your "revelation" is old news and you offer no substantive recommendations for actually helping management measure or actuate programmer productivity. The Peopleware book is factful and entertaining and reaches no better conclusion than you have. After 17 years, don't you think your postulations should improve on previous work. Have you done any research on prior publications?

    1. Re:could this be possibly be more useless? by Amoeba+Protozoa · · Score: 5, Insightful

      I would argue that reiterating something that might not be common knowledge to everybody or perhaps even to one's self is not a waste of anyone's time. It can only help to raise awareness of a particular view on an issue that not everybody may have knowledge of.

      It is from constant retelling of an idea that the idea becomes accepted into culture and things begin to change.

      This is a good idea, so help spread the love man.

      -AP

  3. $ (is what matters) by mlknowle · · Score: 4, Insightful

    In a commercial setting, the awnser is obvious: how much money the software makes is how to measure the programmer's acheivment.

    In a different setting, it's not as clear......

  4. A better measurement is... by Jeremi · · Score: 5, Funny
    Problems solved (or tasks accomplished) per day. Whether you write 500, 5000, or -2000 lines of code to solve the problem is irrelevent, since the code is only a means to an end.


    As far as "what makes a programmer productive", I know what makes a programmer unproductive... reading Slashdot all day. Back to work, all of you! ;^)

    --


    I don't care if it's 90,000 hectares. That lake was not my doing.
  5. Jeebus, talk about stating the obvious by Rogerborg · · Score: 4, Interesting

    Phew, what a long winded way to say: KLOC in any form is a useless metric.

    I was rather hoping for positive suggestions regarding better alternative, and especially some shiny references to back them up for when I take them to my boss.

    The best metric I've found is simply "Time until feature complete". Just that. Elapsed time between a feature being requested and it going live in the field with no bug reports coming back. Anything else is largely bunk. Trouble with that is that it's very hard for twitchy bosses to deal with the interim stages. "Time to code complete" is easier for them to monitor and deal with, but as anyone who has actually supported a product will know, that's only the beginning of a piece of software's life. Push the time to code complete back by a week, and you can save yourself month of grief later. ;-)

    --
    If you were blocking sigs, you wouldn't have to read this.
  6. It depends a lot on Personality by epeus · · Score: 4, Informative

    Fortunately, you can tell a programmer's personality type by the code they write - it is all explained in this paper by Kevin Marks & Maf Vosburgh

    There are various types of programmers around. We've certainly worked with a wide selection. Over the years, we've come to realize that programmers can be divided into various "personality types". You don't stay the same personality-type your whole life though -- as you develop and learn, your approach to programming changes and that change is visible in your code. We're going to look at various functions and how programmers with different personalities would write them.

    MacHack attendees have normally been around the block a few times. That means they have learnt various things, like when you're going around the block, it helps to watch where you're going, and be driving a tank. We know that a function has important responsibilities. It needs to check every error code, keep track of every byte it allocates, and that function needs to know how to cope with anything that happens, cleaning up perfectly after itself and returning an error code which explains what went wrong. But in order to write code like this you have to have made mistakes and learned from them. We know we have...

  7. What makes a programmer highly productive . . . by Pike65 · · Score: 4, Funny

    ; )

    --
    "If being a geek means being passionate about something, then I pity those who aren't geeks." - Pike65
  8. Comment your gd code!! by MongooseCN · · Score: 5, Insightful

    I work on contracts for commercial software and it is amazing how much code people can write and not comment it. I had to change the functionality of some program once and it took me 5 days to write 3 lines of source. Why? Because I had to wade through code with variable names like "int32 data[7];". As a bonus there were hardcoded numbers to the variable. I had to do hex dumps at one point to see where the data was being used and how.

    As I shouldn't even have to say... commmenting your code improves productivity A LOT. Some people say you shouldn't comment code in a commercial product because then you can easily be replaced. My response to that is, why don't you do good work then you won't have to worry about being fired?

    If I had an employee who's not commenting his code, that means the next coder that tries to change something is going to spend a bunch of completely unproductive days just trying to figure out what's going on. I think I'd fire the employee because of his incompetence and the amount of time/money he going to make me waste.

    1. Re:Comment your gd code!! by Rogerborg · · Score: 5, Insightful
      • it is amazing how much code people can write and not comment it

      Point taken, but I rather prefer writing self commenting code. What's better?

      • int32 data[7]; // Number of ISDN terminals per trunk. But then I should really comment every use of this monstrosity as well
      • int32 ISDN_Terminals_Per_Trunk[NUMBER_OF_TRUNKS]; // Why would you need to comment this?

      And anyone who complains that it takes too long to type "ISDN_Terminals_Per_Trunk" compared to "data" really needs to take a cluecheck about the relative amounts of time spend reading and writing code compared to comprehending and fixing it. ;-)

      --
      If you were blocking sigs, you wouldn't have to read this.
  9. Over-valueing comments by kevin42 · · Score: 5, Insightful

    Don't get me wrong, commenting your code is a must.

    However, I would rather have a programmer who writes easily understood code but doesn't document it well than one who writes well documented but overly complex code.

    I've worked on large projects where there was nearly a 1:1 ratio of comments to code, but the comment didn't help you see the big picture because the parts of the application were too far abstracted from reality. And the code was written in strange ways that made it hard for other people to understand.

    In summary, the code can and show be written so that most of it documents itself. If the application is well designed and the code is written well, the need for a lot of in-code commenting goes way down. This is assuming we're not talking about assembler, which in my opinion should have a nearly 1:1 ratio of code/comments.

  10. Not just hypothetical by dbc · · Score: 4, Interesting
    Yes. I have personally worked with a highly productive (and higly respected) programmer who for months had high negative KLOC numbers because his job was replacing kludgy cruft with clean code that actually worked. It was a standing department joke.

    I want to add another angle... I managed validation. I viewed our job as reducing 1-800 support calls to zero. In the end, support costs need to be rolled into productivity numbers for develpers also. A couple of support calls from a single user can easily make the gross margin for the sale to that user negative. (And for you "free beer" programmers -- same thing applies, wouldn't you rather write code than spend time supporting users?)


    And a closing note: A wise manager once said: "Obviously you want smart, productive people on your project. Note that dumb, unproductive people are relatively harmless, because they are not productive enough to cause much damage. What you need to watch out for are dumb, productive people."

  11. Unask the question by MarkusQ · · Score: 5, Insightful
    There are many other ways of measuring programmer productivity. As a programmer and manager-of-programmers, I hold that they all have one feature in common: they are worse than useless.

    Having any defined metric is (IMHO) a Bad Thing in the long run, for the simple reason that people will sooner or later start gaming the metric. If you reward lines of code you get lots of lines of code. If you reward feature points you get lots of features. For a while I tried more abstract things like "user satisfaction," but that started drifting into the "The Customer Is Always Right" syndrom, with all the feature creep and bloat that goes with it. Using "my satisfaction as your manager" is even worse; brown-nosers are a danger to anyone undertaking a team effort with any element of risk.

    So I started wondering: do I realy need to measure productivity at all? Why do I care? The bottom line was, I don't care. I'm not interested in "producivity" any more than I am in "attendence." At this point, I tell people if you want to know what your score is, play a game, open an on line stock market account, or post messages on a web page that keeps track of karma. In this team, the focus is on getting the job done, not on keeping score.

    -- MarkusQ

  12. Ancient issue has been addressed before by GMontag · · Score: 4, Informative

    Ummm, this appears to be a regurgitation of a segment from Triumph of the Nerds . With the Microsoft guys saying that productivity should be based on getting a problem solved vs. the IBM guys saying that productivity should be based on LOC or KLOC (thousands of lines of code) or MLOC (millions) etc.

    Being a "Data Miner" myself, I can certainly agree with the problem-solving-as-productivity approach, rather than the "how many inner joins can I throw at this to make it look like I am busy" approach.

    Actually, the LOC as productivity is so foreign to MY thought process that I can not comprehend why anybody in management or in direct labor would bother to think about it.

  13. Dijkstra on LOC by devphil · · Score: 5, Insightful
    Whether you write 500, 5000, or -2000 lines of code to solve the problem is irrelevent, since the code is only a means to an end.

    Agreed. I think it was Dijkstra who argued that if Lines Of Code are counted, then the number should be viewed as a liability rather than an asset. That is, LOC are not something we produce, but something we spend.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  14. Re:Evaluation: by Anonymous Coward · · Score: 4, Funny
    They should evaluate programmers by the length of thier beards. =)


    And when Ingrid Insightful finishes her day job, she heads off to her night job at the freak show as the bearded lady ;-)

  15. Re:Evaluation: by ackthpt · · Score: 5, Funny
    They should evaluate programmers by the length of thier beards. =)

    Other useful metrics:

    Spelling errors per line of documentation

    Size of chopstick collection

    Volume of spam on harddrive

    How many years out of fashion clothes are

    Months since last date

    Weight of programming manuals in personal collection

    Accumulation of fast food and junk food detritus on keyboard

    How long to gnaw leg off to escape meeting

    How many minutes can talk in jargon and acronyms alone

    Number of hours will voluntarily work if just left alone to do the damn thing

    Age of most out-of-date, yet essential, book and when it became out of date

    Serverity of unintelligible handwriting because everything is usually typed

    Increase in heartrate when new technical journal arrives

    Depth of paper, notes, cans, wrappers, computer bits, et al piled on desk

    Ability to quote from any Monty Python show, movie, recording, book, without error.

    Proportion in size of editor macros relative to actual code

    --

    A feeling of having made the same mistake before: Deja Foobar
  16. Pascal quote by PhilHibbs · · Score: 5, Insightful

    "I have made this letter longer than usual, because I lack the time to make it short."
    -- Blaise Pascal

    If anyone deserved to have a programming language named after him, it was the originator of this quote. I just wish it had been a more concise and expressive language.

  17. The Mythical Man-Month by Animats · · Score: 5, Informative

    This guy clearly hasn't read The Mythical Man-Month. He should.

  18. I have! by barzok · · Score: 5, Insightful

    About 2 years ago, I was working on my first major project and the project manager called me one day out of nowhere to ask where my progress was (normally we covered this in a weekly meeting). I started giving him percentage estimates based on feature completeness, structure completeness, etc.

    So then he asks "how many lines of code do you have?" I tell him that I don't use that as a gauge, I use what I just told him for my progress. Also told him that I don't count lines. He persisted, so I came up with a rough count. He says "so if you say you're at 60%, and have X lines of code written, then you'll have Y lines when you're done, right?"

    I had to reiterate (for the third time in that phone call) that LOC means nothing - it may very well be that I only had 100 lines left to put together, but it would tie up the remaining functionality needed (by gluing all my pieces together).

    But he just kept coming back and harping on that LOC number, no matter how I tried to persuade him that it was meaningless. He was convinced that this was how he would know how much work went into the project. I guess the 3 weeks of writing very little code and charting out the logic of the app didn't mean much to him. He was taken aback when I told him "I don't just start writing code on day 1, I plan things out"

    1. Re:I have! by Skidge · · Score: 5, Funny

      This is why you tell managers numbers that will make them comfortable with your progress, no matter if they are really accurate. The better your managers feel about your work on the project, the better you will feel, since they will stop bothering you as much. In other words, arbitrary and meaningless questions deserve arbitrary and meaningless answers.

      Of course, you still need to finish everything on time or your arbitrary and meaningless answers won't work the next time. :)

    2. Re:I have! by Mike1024 · · Score: 5, Insightful

      Hey,

      The project manager called me one day out of nowhere to ask where my progress was... I started giving him percentage estimates based on feature completeness, structure completeness, etc.

      So then he asks "how many lines of code do you have?"


      You should of told him that just today you Enhanced Shareholder Value by rearranging your equations, converting this:

      Foo := sqrt((1/3)*(x+5))

      to this:

      Foo := X + 5
      Foo := 0.333333 * Foo
      Foo := sqrt(Foo)

      This lead to a threefold increase in lines of code, whilst making the program clearer and easier to maintain.

      Tomorrow, you should say, I plan to modify all our string-processing code to work only in the flexible and intuitive EBCDIC instead of the ASCII which we already have libraries for. Liberal use of copy and paste could lead to a 65% increase in lines of code.

      Michael

      --
      "Goodness me, how unlike the FBI to abuse the trust of the American public." -- The Onion
  19. This is a recycled article. by Webmonger · · Score: 5, Insightful

    The article originally appeared here last week. Sheesh. Don't pretend it's an original Slashdot article if it's not.

  20. Comments by naming by Howling+Loon · · Score: 4, Interesting

    I like commentParserDatabaseCursor. I also like i, j, p, and retval. The length of an identifier should be roughly proportional to the log of the size of its scope. A file scope "i" is an abomination. A loop scope "commentParserDatabaseCursor" is an idiocy.

  21. true enlightenment by archen · · Score: 5, Funny

    Boss: How many lines of code did you do today?
    Coder: 1
    Boss: [next day], how many lines did you do today?
    Coder: 1
    Boss: [day 3] how many lines did you do today?
    Coder: 1
    Boss: how come you only do one line per day
    Coder: Actually I'm working on the same line.
    Boss: How many lines is the damn program?!?
    Coder: 1
    Boss: You're programming in Perl again arent you...

  22. Measuring coders' productivity just doesn't work by casmithva · · Score: 4, Interesting
    Over my years in the business I've encountered the following means of measuring a programmer's productivity:

    Number of lines of code written, highest score wins. In short, why write in 100 lines what you can write in 1,000?

    Number of lines of code written, lowest score wins. You end up with your own obfuscated coding contest. You might also find people rewriting other people's work, redesigning APIs and other infrastructure components, for no reason other than to lower their own score. This can lead to total chaos, fights in the parking lot, etc.

    Number of good lines of code written a month. What's the definition of "good," and how subjective is it? If it includes comments, then how is the usefulness of a comment determined? I've seen developers write more comments than code, and in the end the comments said nothing useful that would've helped a new developer maintain the code.

    Number of bugs fixed in a month. The programmer who spent a month researching the sev 2 bug that was affecting system availability or data integrity for the last three months isn't recognized for his/her achievements, while the intern who fixed 100 bugs pertaining to typos on the website and in the documentation is rewarded.

    Number of bugs created in a month, lowest score wins. Nice idea, punishing people for creating bugs, but people might get so paranoid about causing bugs that the turnaround time for code is obscenely high.

    Code complexity metric, lowest score wins: All this proves is that the programmer's capable of writing non-complex code but says nothing about the documentation for the code, the overall design of the component or subsystem the programmer was working on, etc.

    Number of tasks completed in a month. This screws the guy who's got a hefty task that cannot be divided any further or the programmer waiting on the sysadmin to install the necessary development tools so that he/she can actually get started.

    Customer satisfaction. The customers are pissed because the website is unstable, but the rest of the back office system is running perfectly fine. In the end, everyone -- the back-office developers, the database guys -- is punished when only the website people should've been put on call center duty for a week.

    Number of customer issues resolved. There's a great incentive here to solve issues with kludgy hacks which, in six months to a year, might leave the company with a very flaky, unmaintainable system.

    360-degree input, or "Mutually Assurred Destruction". This was a system IBM used -- still uses? -- where your peers, some picked by you, some by your manager, would fill out a survey and offer opinions about you. The manager would then piece it all together and come up with a result. Like Dilbert called it, it's "mutually-assurred destruction," although I saw it work the exact opposite way many times.

    There's so much more that goes into developing and delivering software than just writing lines of code. And the number of lines of code written isn't all that significant if the design sucks, if the documentation is unusable by the people who need it, if the call center people supporting the thing aren't trained properly, or if the systems supporting the website or the database are unstable. How do you put a score next to a name when many of the things contributing to that score are subjective or out of the control of the person being scored? We're not building CD players here!

  23. Was that all? by matsh · · Score: 4, Insightful

    This guy is "president of CHC-3 Consulting, teaches software engineering to corporate and university audiences, and writes frequently on computer topics". Still he failed to mention function points (an old measure of product size) or use cases (a more modern measure of product size).

    He also fails to recognize that programming is a group activity, where one person can be seemingly unproductive, but in reality being vital for the productivity of the group. Typical such persons are mentors, which spends some of their time helping others. Mentors may not produce a single line of code, but still be the most valuable person in the group.

    Alistair Cockburn does in his modern classic "Agile Software Development" state that software development is a "Cooperative Game of Invention and Communication". Therefore the productivity is best measured at the team level, since they are, in the end, cooperating.

    Also, I think it is quite clear that use cases, or user stories, or whatever you wish to call them, are the best way to describe the wishes of the customer. Fulfilling these wishes are ultimately the only thing that matters.

    So, I would say that the number of finished use cases per unit of time, for the whole team, is by far the most meaningful measure of productivity.

    Mats

  24. Problem w/ design docs by Mr.+Fred+Smoothie · · Score: 4, Insightful
    The problem with "proper design docs" is that time spent writing them and keeping them up to date in the face of constant requirements change is time not spent actually writing software and keeping it up to date in the face of constant requirements change.

    You should strive to make your design docs just good enough for the people who'll be reading them -- the maintenance programmers, who will also have the code. In other words, the design docs are the cliffnotes to the code. The code is always the authoritative design documentation.

    BTW, I STRONGLY recommend reading Agile Software Development for anyone who's seriously interested in these issues.

    --

  25. Similar experiences right now... by spectecjr · · Score: 4, Interesting

    The firm I'm working for hired a contractor to write the system software for their scientific instrument.

    They later hired me.

    It is now my job to maintain, expand and rewrite his original code as the device gets further from the prototyping stage.

    Here's some metrics for you:

    4000 lines of C code

    Avg. Variable name length: 3 to 4 characters

    Avg. Function Name Length: 3 to 4 characters

    Total number of functions (not including state-machine functions): 9

    Amount of documentation: nearly 0. Comments are laughable.

    Total number of functions, including state-machine functions labelled from stsws0 through stsws30 - 40.

    Total number of constant values used without #defines or assigned names: Too many to count.

    Amount of documentation of constant values that aren't obviously for buffer/scratch space, but actually do something important: Zero.

    Amount of dead code: Current investigation indicates somewhere between 30% and 60%.

    Amount of dead code interspered with live code, so it's really difficult to work out what's a dead function, and what's live: All of it.

    Level of interweaving of dead code and live code: pretty damn high.

    Use of pound-defines for code switching and giving alternate code paths: Zero.

    Use of pound-defines to switch blocks on and off that really you want to keep on ALL THE TIME (particularly as the app crashes if you turn them off): 10

    Interesting idioms:
    -- Use of pound-if(0) and pound-endif to bracket (useless) comment sections, eg:
    pound-if(0)
    This is a comment.
    pound-endif

    -- Use of a while loop to do error handling. Eg;

    while (TRUE) {
    if (condition) { error = 5; break; }
    ... other conditional code
    break; // to exit
    }

    if (error) ...

    Number of pound-includes that are actually totally unneeded:
    5.

    Number of Windows 3.1 programming idioms used: 2 found so far. In a piece of code that *requires* NT4 and as such is Win32 only.

    Other interesting idioms: Massively nested if's EVERYWHERE. Very little modularisation. Grabbing an HDC at that start of the app and not letting it go until shutdown, without specifying a Class DC.

    The guy REWROTE FROM SCRATCH button controls and edit controls, using WM_MOUSExxx message and WM_CHAR handling, as part of the main frame window. Each edit/button has a separate cut/paste if statement block to handle it. There are about 80 controls on the main screen. This code is cut and pasted for each single control.

    And for the final piéce de resistance;

    Total number of local variables used: ZERO. 0. Nada. Zilch. EVERYTHING IS A GLOBAL VARIABLE.

    --
    Coming soon - pyrogyra