Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming IT Technology

It's Not About Lines of Code 517

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.
This discussion has been archived. No new comments can be posted.

It's Not About Lines of Code

Comments Filter:
  • by T5 ( 308759 ) on Monday March 18, 2002 @01:34PM (#3181565)
    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?
    • by Sc00ter ( 99550 ) on Monday March 18, 2002 @01:37PM (#3181594) Homepage
      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.

      • by ivan256 ( 17499 ) on Monday March 18, 2002 @01:44PM (#3181667)
        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.
        • "It's hard to look at an unfinished piece of software and know how it's coming along"

          That would depend on the development method and the actual product being developed. If you're developing APIs or libraries for other people to use, then you really can't "see" how far along it is, although you could count function or components complete. However, if you're developing something like a website or a client application, then you can see how far along things are though.

          Of course I completely agree with measuring lines of code being boneheaded, unless of course the number of lines of code for the final product is known before it starts. Luckily I work with people that understand that numbers are irrelevant, and that the product won't be finished until long after it has been released to the public.

          As far as an ideal solution, give the managers the convoluted formula of computing productivity that results in an answer that only slightly deviates from a standard amount. That way at least they'll stay out of your hair long enough to get some coding done.
        • If managers want a measure of progress then the team should know this.

          "Percieved" progress and "actual" progress can vary. A prototype can give a lot of percieved progress but no (hopefully) actual progress.

          80-20 rule always kicks in when trying to measure progress. I've known developers who manage to keep their project 90% complete (yeah, you know who you are) for a very long time.

          I prefer having an almost constantly shippable product from the outset. It's difficult to achieve early on but it can be done very soon with basic functionality.

          It also provides a good way to test design and implementation. Aim to get something working within spec. asap and everyone will be pleased.

          It also provides a good measure of progress. Ticking features off a list reassures the managers and gives a good boost to the team. Admittedly it's not possible for some projects with lots of core features needed to be built from scratch.

          Should the shit hit the fan (like a competitor doing a release) then features can be dropped and the product shipped much quicker. It means renaging on some promises made to customers but if you have been open and honest with them they'll understand, also, if you release early/often they don't mind waiting for X if the have Y.

          You've just got to keep an eye on the team, harass them for quality, and reward excellence.

          My measure of productivity is based on delivery of code/features that falls within my quality guidelines. This includes lack of bugs, code layout, comments and reuse. e.g. A feature can be 'working to spec.' but if it has no comments in the code then it's not 'finished'.

          I also know developers that quickly write the code, do all the testing and then call the feature finished. They then go back and add comments, correct variable naming and touch the code in other ways (adding whitespace, reoganising if's) - they fail to realise that they now need to perform all the same tests again, which of course they never do. This is *low* productivity IMO and is generally poor style.

          Coding *is* art and I am an 'artished'.
        • by Skyshadow ( 508 ) on Monday March 18, 2002 @03:52PM (#3182470) Homepage
          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.

      • Leonardo spent a total of 20 years on Jaconda, he never actually finished it and this painting is considered to be a work of genius and costs millions... I think Mona Lisa was an average sized person (no matter who she or he was) by your definition Davinci should have being able to correctly predict the amount of time it took to do. (In this case, Leonardo was the customer) So what was that you said about productivity?
      • No! Creatitivity can not be compelled. The parent post spoke of Michelangelo, so you should do some research before replying. Read The Agony and the Ecstacy for a better--although fictionalized--insight into the life of an artist.

    • by ackthpt ( 218170 ) on Monday March 18, 2002 @01:40PM (#3181622) Homepage Journal
      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."

    • by Darth_Burrito ( 227272 ) on Monday March 18, 2002 @02:35PM (#3182000)
      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
    • Tony Hoare (Score:3, Insightful)

      by Zeinfeld ( 263942 )
      Tony Hoare said much the same thing about 15 years ago. I think it was his ACM lecture accepting the Turing award where he said that lines of code per day should probably count against the programmer. Come to that 'The Mythical Man Month' said much the same thing.

      I don't think anyone has ever claimed lines of code per day is a useful or meaningful measure, except of course for pointy haired bosses.

    • by loydcc ( 325726 ) on Monday March 18, 2002 @05:06PM (#3182858) Journal
      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.

  • by nsqtr ( 525403 ) on Monday March 18, 2002 @01:36PM (#3181589)
    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?
    • Beat me to the punch.

      This is old news, and if a manager is looking at lines of code produced, as opposed to general quality of the overall product, your manager is 95.

      I have yet to see a manager look at "lines of code" as any type of measurement.
      Has anyone?
      • I have! (Score:5, Insightful)

        by barzok ( 26681 ) on Monday March 18, 2002 @02:27PM (#3181957)
        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"
        • Re:I have! (Score:5, Funny)

          by Skidge ( 316075 ) on Monday March 18, 2002 @03:12PM (#3182231)
          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. :)
        • Re:I have! (Score:5, Insightful)

          by Mike1024 ( 184871 ) on Monday March 18, 2002 @06:00PM (#3183229)
          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
      • Not LOC, but HIO (Score:3, Informative)

        by richieb ( 3277 )
        I have yet to see a manager look at "lines of code" as any type of measurement. Has anyone?

        However, I still lots of people's effor being measured by HIO (Hours in Office).

    • I don't think the author ever pretended he was the first one to come up with the ideas he mentions in the article. Just because someone has already written a book along the same lines it doesn't make the article useless.

      Having said that, the fact that he offers no alternatives does make the value of the article questionable. But perhaps the point of the article was to raise ideas of how one could evaluate the amount of work done - and the author didn't want to bias this by suggesting a particular method?

      If so, then this is far preferable than an 'Ask Slashdot - how do I measure my programmer's productivity?'

    • 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
    • After 17 years, don't you think your postulations should improve on previous work. Have you done any research on prior publications?

      Uh, it looks like this blurb was introduced as an item of discussion and not a research paper. I thought the blurb was cleaning written and succinct about an issue of interest to many /.ers. These observations are easy to deduce. The issue of productivity has been hashed by philosphers, economists and others for millinnea. Most of What DeMarco said 17 years ago was simply rehashing of others works.

      Economists generally define productivity as the amount of money that your product brings in compared to the hours you worked on it. In this case, the MS programmer who dropped a nasty bug in WinWord, and caused the MS faithful to spend a few billion dollars on the next WinWord release would qualify as the most productive programmer of the year.
    • Your "revelation" is old news and you offer no substantive recommendations for actually helping management measure or actuate programmer productivity.

      Huh? What are you talking about!?

      Now I suppose you're going to call the "Man-Month" measurement of a project's size some kind of myth!!

  • Evaluation: (Score:3, Funny)

    by L-Wave ( 515413 ) on Monday March 18, 2002 @01:37PM (#3181595)
    They should evaluate programmers by the length of thier beards. =)
    • by Anonymous Coward on Monday March 18, 2002 @01:52PM (#3181727)
      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 ;-)

    • by ackthpt ( 218170 ) on Monday March 18, 2002 @01:53PM (#3181740) Homepage Journal
      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

  • by mlknowle ( 175506 ) on Monday March 18, 2002 @01:37PM (#3181598) Homepage Journal
    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......
    • How much money does the data access layer of a web application make, compared to the user interface? How much does the overall design make, as opposed to the constructed code? IMHO, a useful metric has to take into account elegant, simple implementations, refactoring, reuse, test coverage, bug counts.....and the list goes on. Net sales aren't so much a factor as overall cost. Maybe $$$/function point?
    • You realize that by this measure Microsoft has the most productive coders in the world.

      Oh yeah, all those people who made/created Linux are completely unproductive.

      The big problem with any of these measures is you're measuring the wrong "product". Computer code isn't a product, it's a means to an end. Computer code is the final instantiation of an entire process from planning, to coding, to testing, to execution, to refining. First off, the version 1.0 of almost any program isn't the final product (fortunately). Second, wonderful, bug free code accessing the worst structured database is still a terrible application.

      So, the idea of evaluating productivity by looking at the code is just plain silly. Evaluate the project.
  • by Jeremi ( 14640 ) on Monday March 18, 2002 @01:38PM (#3181604) Homepage
    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! ;^)

    • Would those be simple problems solved, or major engineering problems solved? Would the programmer who made a button change the values in a form to the correct ones have accomplished as much as someone who developed a more scalable network protocol, or increased the paralellism of a complex algorithim, or came up with a new mathematical theorm? Is the stupid manager going to decide that the button problem was harder to solve because the IDE generated 500 lines of code for his button click, while the computer scientist only generated a few pages of scribbling in his notebook?
    • Dijkstra on LOC (Score:5, Insightful)

      by devphil ( 51341 ) on Monday March 18, 2002 @01:52PM (#3181726) Homepage
      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.

    • Using problems solved per day wouldn't be good. For one, some problems and projects can be spread over days, weeks, and months. This means that the number of problems solved will be less for someone working on a harder project than someone who works on simpler projects (and problems).

      Also, I would also have to disagree with the article. The following comment really isn't true: "[h]is code is shorter and simpler, and simplicity is almost always better in engineering". The larger code code be contained in well thought out objects, or functions, that make the reading of the main Objects, or functions, simpler to read, and the main bulk of the code if well engineered could also be reused easily.
      In his above example, Danny's code may not be anymore reusuable than Fred's. Danny's smaller number of lines per code could be result of not taking into account all necessary possibilities, or not thinking about possible future problems.
      The size of the code just doesn't matter. What does matter is how well the code is thought out and commented (both insertions and deletions of code). Well thought out code usually can produce some reusuable code and/or design patterns. Personally, as a rule of thumb, I don't like to write code more than three times for a given task or problem--unless I absolutely have to write it more times.
  • ...how much time it takes to get the job done right?

    • I'll disagree. Using a Java Example:
      One company makes the product in 4 weeks. Looking at the JSP's is a nightmare (because all the code is within the JSP's).
      Another company makes the product in 8 weeks. The JSP's are all done with taglibs, and the entire site is used with EJBs.

      The first product is done twice as fast. But the second product is ten times easier to maintain, and fully scalable.

      Which would you prefer?

      As a disclaimer, if you want something simple and quickly, sure the first way is the way to go, but for anything that I'd consider a "product" the second way is better.
      • If the goal was to get the product launched in 6 weeks, then the 8 week one failed. It's obviously better code, but code that still fails to meet the objective.
  • So it is not important, how fast you drive, but that you are actually driving in the right direction...

    What else is new ?
  • by MrFredBloggs ( 529276 ) on Monday March 18, 2002 @01:40PM (#3181623) Homepage
    A good programmer looks like a bad programmer - both try to get away with writing as little code as they can.

    Its not perfect (ideally code is not quite optimized to perfection - its nice to trade a little size for readability) but it seems roughly accurate.
  • by Rogerborg ( 306625 ) on Monday March 18, 2002 @01:41PM (#3181626) Homepage

    Phew, what a long winded way to say: KLOC [analogx.com] 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. ;-)

  • by CresentCityRon ( 2570 ) on Monday March 18, 2002 @01:41PM (#3181627)
    This article was rather superficial and should have covered one point instead of several, giving the article a bit more depth. I got the feeling like it was written off the cuff this morning.

    (How do I know Danny does more work just because he does the same amount of work in less code. Its like the author follows some reverse logical mistake that he is harping about.)

    A very interesting book on this subject is "The Psychology of Computer Programming" by Weinberg. It will get you thinking! I think the "Mythical Man Month" also discusses related topics.

    Thanks
  • by epeus ( 84683 ) on Monday March 18, 2002 @01:41PM (#3181630) Homepage Journal
    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 [mac.com]

    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...
  • I think the only other items I would add to this are pursuit of programmer metrics include

    • How enduring the code and design are
    • How extensible
    • How much other programmers like to extend the original code that a programmer wrote.

    It's hard to measure that, because the superficial situations are identical: programmers enthusiastically extending some well designed code on one hand, and a set of programmers grumbling about fixing things in a poorly written chunk of code.

  • by mccalli ( 323026 ) on Monday March 18, 2002 @01:42PM (#3181641) Homepage
    What makes a programmer highly productive?...I...propose a new definition

    One of the things that makes good programmer full stop is not worrying about trying to measure the imeasurable.

    Cheers,
    Ian

  • Old news (Score:3, Insightful)

    by www.sorehands.com ( 142825 ) on Monday March 18, 2002 @01:43PM (#3181648) Homepage
    There was a piece a long time ago that compared the costs of hiring a Super programmer, and average programmer, and an incompetent programmer.


    It compared the lines of code and number of bugs to the salaries. Of course it said it was cheaper to hire a super programmer. But, it found that the only difference between the average programmer and the incompetent programmer was the number of bugs generated, not the lines of code.

    People need to be reminded of the high cost of debugging. It takes a long time to track down a bug.

  • by Pike65 ( 454932 ) on Monday March 18, 2002 @01:43PM (#3181649) Homepage
    ; ) [thinkgeek.com]
  • by mblase ( 200735 ) on Monday March 18, 2002 @01:43PM (#3181656)
    Your manager doesn't care how many lines of code you do or don't write. He doesn't care what those lines do, or how they work. That's because the client or customer doesn't care about those things. All they do care about is features: Did you add what we needed to add today? Did you finish ahead of schedule or behind it? Will we deliver on time or a week later?

    Optimize on your own time. All the non-developers care about is what gets into the final product, and if you meet the list of desired features, then you're productive. End of story.
  • Near- total idiocy (Score:2, Interesting)

    by PigleT ( 28894 )
    Spot the bug in this thought, then:

    "Danny's code probably will be easier to extend and modify, and likely will have a longer lifespan, because of its compactness."

    This is potentially utter rot. If you make something "compact" then you're quite likely *using* the language to insert every idiom you can think of. That makes code *unreadable*, not productive at all.
    (Yes, I've been known to argue in favour of using prgramming languages' idioms before now, and more to the point I expect folks who dare to look at my code output to be able to read it, or else have the decency not to criticise it) but there are limits.

    The alternative is that he's implemented a sufficiently different top-level algorithm - and at that point you're not comparing like with like so you can't say one person is any more productive than another.
    However, you could introduce "amount of desired algorithm implemented per day" into the formula for productivity calculation.
  • by MongooseCN ( 139203 ) on Monday March 18, 2002 @01:45PM (#3181668) Homepage
    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.
    • by Rogerborg ( 306625 ) on Monday March 18, 2002 @02:14PM (#3181897) Homepage
      • 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. ;-)

      • Comments by naming (Score:4, Interesting)

        by Howling Loon ( 565528 ) on Monday March 18, 2002 @03:12PM (#3182232)
        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.
    • by spectecjr ( 31235 ) on Monday March 18, 2002 @06:29PM (#3183404) Homepage
      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.
  • I talked to my boss one day about how the engineers where I work are measured. Basically, it's along the lines of 'does the work get done?'. The project is defined with milestones set over a period of time, and if a deadline is missed the milestones are moved around a bit.

    We have engineers that may spend a day or two writing out a document to assist their coding the next day. That isn't considered a ding in their productivity. If anything, providing an insight into their code before they write it (psuedocode, not commenting) has been very helpful, particularly when the other engineers need to code parts that talk to each other.

    I honestly have no idea how this would scale to a >50 employee company. If it's really that important to make sure you're squeezing every ounce of productivity from your employee, I'd be concerned about where exactly that company is heading. Seems like investing more time into pre-planning would be more fruitful than lighting a fire under an employee to attain 'measurable goals'.

    In some ways, I'm glad I didn't choose programming. It's quite frustrating to predict when you'll have code you've never written before.
  • by kevin42 ( 161303 ) on Monday March 18, 2002 @01:47PM (#3181683)
    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.
    • The ratio of code to comment is not important. It's not quantity, it's quality. The comment needs to say anything that is not obvious from the code that needs to be said for the reader, who knows nothing about the code, to understand what is going on.

      Another important feature of comments is a changelog-ish sort of function whereby each software change is documented within the code. Where I work, all of us in Sustaining Engineering write in a bug number with each change that we make so we can go back and find why that change was made later on when we look at the code and wonder why the heck we did that.

      These are a few good rules of thumb in my experience at least..

      Ben
  • Imagine Fred, Danny, and a third programmer, Ingrid Insightful, are given similar assignments. Fred and Danny head right to their desks and begin writing good code. Something about the assignment bothers Ingrid however, so she decides to go outside for a walk. After a lap around the park, she buys a decaf mochaccino, sips a little, and lies down under a tree. Soon she falls asleep.

    Now, if I can just get my boss to endorse this programming style...

  • by Raphael ( 18701 ) on Monday March 18, 2002 @01:48PM (#3181693) Homepage Journal

    This article seems to raise more questions than it attempts to answer... This is not surprising because the "programmer productivity" has been the subject of many debates.

    The proposed definition ("Ability to solve customer problems quickly") seems to ignore several of the good points mentioned earlier. For example, one can be able to solve a customer's problem quickly with an ugly hack. Some undocumented spaghetti code full of black magic may be able to solve one problem quickly, but it would be impossible for anyone to maintain this code later. Or to re-use it for solving someone else's problem.

    So who is more productive? The one who solved the problem quickly with an ugly hack or the one who solved the same problem by writing clean, documented and re-usable code?

    So it is a pity that what appears to be the conclusion of this article has thrown away the notion of clean and well-documented code mentioned earlier. Maybe a better (but more complex) definition would be: "Ability to solve customer problems quickly and to solve future, similar, problems in a quicker way". The drawback of this definition is that it cannot be measured on the current project, but only when the next one appears.

  • by dbc ( 135354 ) on Monday March 18, 2002 @01:49PM (#3181696)
    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."

  • i agree (Score:2, Insightful)

    by cballowe ( 318307 )
    I've always operated like Ingrid Insightful - I just can't convince managers to agree with me. If I could I'd make mid-day trips down to the Art Institute, or just go for a stroll while thinking about anything but the problem (strangely, the answers always come to me as soon as I get my mind far enough away from the problem that I can see the big picture clearly ... or maybe it's not so strange).

    Unfortunatly, I'm doing consulting work and there's something about the client prefering to pay for time on site. Suggestions for beating these concepts into management?
  • Unask the question (Score:5, Insightful)

    by MarkusQ ( 450076 ) on Monday March 18, 2002 @01:50PM (#3181704) Journal
    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

  • Ummm, this appears to be a regurgitation of a segment from Triumph of the Nerds [pbs.org]. 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.
  • A dated approach (Score:3, Interesting)

    by Glock27 ( 446276 ) on Monday March 18, 2002 @01:51PM (#3181709)
    Given today's environments, with a ton of already available classes and components an important measure of productivity is how well these things are reused. "KLOC per day", in any form, is a very poor metric for this.

    A metric that takes real productivity into account for new projects (the Ingrid example above wasn't a great one since she was maintaining code, not creating it) would be one that measures requirements met versus time. It would of course be up to the manager to say whether the time taken was too long, about right, or less than expected.

    A developer that consistently meets requirements with working code, in a timely manner, is a good developer.

    Clearly the key to success with this metric is managing your manager's expectations. ;-)

  • It's not about lines of code.

    It never was. Or maybe it was, back then.

    Old-school lines of code were assembly instructions, or COBOL statements (which map fairly easily to assembler anyway).

    But all this has changed, a lot.
    Software these days is about components, about reuse, about APIs. Reinventing printf gets you more lines of code, but is useless and stupid (in most cases).

    Object orientation throws productivity into a whole new ball game. You should get productivity points for reusing code, not for rewriting. So it's never, hasn't been for some time, about lines of code.

    Even function points are better.

    But anyway, is productivity such an issue for programmers?

    Productivity is a business concern, and makes sense in a business environment. And businesses don't (shouldn't) build software by throwing programmers at it.

    Businesses build software through a process that involves requirements, analysis, then design, test suites, and then coding and testing and documenting.

    What part of all this does programming involve? 15%?

    Forget lines of code. Forget kindergarden productivity measures, forget subjective analysis into what is "good code" and "documented code". You document BEFORE you code. And it is "good code" if it implements what is documented.

    Anything else is just fooling around.

  • Time and Money (Score:2, Interesting)

    by stoolpigeon ( 454276 )
    It is really all about time and money. Both have already been posted seperately but these 2 measurements are the clincher.

    Sometimes really good code is just not worth it.

    Sometimes code is not worth it period. (There are better ways to solve the problem than a custom process)

    If you don't make enough money to pay for the time- you won't be in business long. (At least as long as your software engineers are willing to live off their own credit cards and pick up company expenses.)

    .
  • I'm not impressed (Score:3, Interesting)

    by Zen Mastuh ( 456254 ) on Monday March 18, 2002 @01:55PM (#3181757)

    While I admire the author's brave attempt to establish a new model, I must conclude that he has failed: Applying a quantitative measurement to a qualitative phenomenon is absurd. Do we judge a painter by the number of brushstrokes and conclude that Rothko is lazy and Van Gogh is a diligent worker?

    There are many qualitative components by which a programmer can potentially be judged: sheer output, ability to debug others' code, ability to have code debugged by others, ability to create understandable extra-code documentation, affinity for the lifestyle of the person doing the judging (i.e., likes to go out for a beer after work, roots for the same professional sports team, etc...), concentration skills, hygeine, and so on. Attaching metrics to this is nothing short of masturbating one's ego. There is a wonderful allegory to this in Robert Anton Wilson's Schrödinger's Cat trilogy, in which a self-important researcher attempts to rate a woman's orgasm using measurements on scales developed by the doctor himself.

  • Imagine his code ... contains no comments at all ... The next programmer to take over Fred's code will find it impenetrable

    Amen, brother. I was the poor bastard who was the "next programmer". Fixing "Fred's" poorly written and worse documented code did do wonders for my skills, however.

  • The real question (Score:3, Insightful)

    by ahde ( 95143 ) on Monday March 18, 2002 @01:57PM (#3181766) Homepage
    isn't who was more productive, Fred or Danny, in the situation above, but who was more productive if Fred wrote his 5000 lines in 5 days and got it done, and Danny wrote his 2500 lines, took him 10 days to get it done.

    That's the dilemma facing project managers-- is it better to "get it working now" or "ease extensibility/maintenance later." There is no hard and fast solution. It's different for every project, and often misjudged, in part because you can't see into the future to determine its lifespan. Of course everyone wants two Dannys who get done in 5 days, but that's not the real world scenario.
  • Productivity (Score:2, Insightful)

    by soap.xml ( 469053 )

    Measuing the productivity of a software "designer/engineer/coder" or whatever you want to call them, is a very difficult thing to do. On our current project we are using a third party tool that is riddled with bugs, unfortuantly due to management desicions we are unable to ditch the product and search for a different tool. However, my team has remained highly productive during this past month while working with the vendor to solve the issues.

    Have we produced many lines of code? Not really, probably around 9000 lines between the 6 of us over the past month, that is about 1500 lines per programmer... in over a month. According to any logic using "lines per day" or anything along those lines, we are in horrible shape. However, we have been solving many of the issues with the vendor, scouring over lines of code to ensure that the tools are working correctly, changing and tweaking our testing classes (Java) to ensure that everything is truly working the way that it is supposed to be.

    Now, with about a month of time wasted according to typical programmer productivity analysis, we have a decent library of functionality built up (or easily migrated into a library), we are very familiar with the product that we are using and the APIs, and will probably come in on, or before schedule.

    Was that time wasted? Were we unproductive? I would say no to both of those questions. Yes working with a vendor with broken software was frusterating and time consuming, however we now have an intamite knowledge of a third-party "black box" and we have, in the process of working with them, built up a suite of test cases that will help us immensily in the near-term future.

    But, we only turned out 1500 lines per programmer in a month you say. However do to all of the debugging work, and API "scouring" we have done, we will probably be able to turn out closer to 500-1500 lines of good well documented and working code every day or so.

    Well my point is simply this: Lines of code per day is simply not a good analysis. The best way to determin productivity is on a per project basis. How is the project coming? Are the objectives being met, are you solving the problems that are coming up in a timely fasion? There is no final answer, it must be evaluated per-project, per-team, per-company.

    -ryan
  • Wow, it's so wonderful to see such incisive an understanding of programmer productivity. Who knew that lines of code is a bad measurement of productivity? This changes everything!

    Oh...wait a minute...this would be old news if it were posted on slashdot circa 1975, it's positively fossilized now. Sheesh.
  • ...this article, life (for me) would be a better thing. Thanks for noticing that the best way to solve a problem is not always to sit down and start coding until you have coded a solution.
    I have seen a lot of good programmers code for hours, but I have also seen truly gifted programmers walk around and "process in the background", then go back and present a solution just as valid but with much less "machine time".
    Sir_Haxalot
  • What stuns me is that there is evidently a plan in some municipalities want to tax software development efforts as if it were a manufacturing business.

    For me software is a consultative and artistic endeavor.

    I don't know how "science" ever made it into the moniker -- when they tax architects perhaps it would be categorically fair.
  • by sterno ( 16320 ) on Monday March 18, 2002 @02:02PM (#3181813) Homepage
    This is yet another case of trying to quantify something that is qualitiative. It's is pointless to try to measure somebody's quality as a programmer (or as anything else for that matter) by using some numerical assessment. The examples above demonstrate that clearly, but here's a couple more examples:

    Which is more valuable, a programmer who churns out 1000 lines of code/day but very reclusive or the one that does 500 but is also good at communicating project directions with others?

    Which is more valuable, an inexperienced programmer who learns quickly or an experienced programmer who doesn't?

    if you want to know how good a programmer is to ask them the right questions. I'm not sure exactly what those questions are, it depends on what you want out of them. But I've been on many interviews and it's amazed me the vast differences in interview quality. People who are trying to measure the quality of a programmer by "lines of code" are setting themselves for lots of problems.

    I think I was asked once to estimate lines of code I've written and I had NO idea. Frankly if somebody did know the answer to that question I'd be concerned. It sounds like somebody who's too busy keep track of the metrics that imply their skill rather than actually doing good work. These are likely the same people who are staring at the clock for the last 15 minutes of the day, constantly estimating the minimum amount they need to do to get by.
  • by rtaylor ( 70602 )
    If someone demanded more lines of code from me I'd write a perl script which would take all my loops and unroll them, then the function calls inline.

    Never again would they want more lines of code.
  • Deleting Code (Score:2, Interesting)

    Sometimes I feel most productive after I have deleted thousands of lines of code. Code that has been replaced by better code. A good day is when CVSweb reports +500 lines -3000 lines.
  • Can't measure... (Score:3, Informative)

    by sporty ( 27564 ) on Monday March 18, 2002 @02:05PM (#3181836) Homepage
    *sigh* Code quality is subjective. Perfect example:

    if( 1 == x )

    Runs fine, looks butt ugly, but works. Is this of quality? As long as it works? As long as its easily readable?

    What about a function that does:
    int x ( int a, int b ) { return a/b; }
    Runs fast. Can break.

    Its all subjective baby. You can't measure it by speed of coding, by lines of code, number of functions, number of bugs..etc... Its a matter of the employeer of the programmer being happy with his output.

    Next questin :)
  • Pascal quote (Score:5, Insightful)

    by PhilHibbs ( 4537 ) <snarks@gmail.com> on Monday March 18, 2002 @02:07PM (#3181849) Journal
    "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.
  • by Animats ( 122034 ) on Monday March 18, 2002 @02:13PM (#3181892) Homepage
    This guy clearly hasn't read The Mythical Man-Month [amazon.com]. He should.
  • by dbretton ( 242493 ) on Monday March 18, 2002 @02:24PM (#3181947) Homepage
    The writer is truly missing the point regarding the purpose of measuring performance regarding lines of code.
    Source Lines of Code (LOC or SLOC) are used, by management, to get an understanding of the overall productivity of software engineers in general. It is not an end-all,be-all rule regarding software engineering.
    If you take a sampling of 100 good programmers, given clear requirements, and measure their performance, you will be able to determine the overall productivity for a single engineer on a per day/week/month/year basis. This allows managers to make some determinations regarding project planning, enhancements, changes, and yes, to some degree, the performance of engineers.

    For example, if I know that my engineering group of X people are capable of contributing 1000 LOC per person per month (per man-month) to a project, then I can better estimate the cost and schedule of a new project. The project's scope is determined by detailing the customer's desires, and developing a break-down of capability. (Things such as R&D, training, and new technologies are identified and have an appropriate risk factor associated with then).
    A LOC estimate is associated with each capability, which consequently will produce a timeline and cost.

    What the author should have really reflected upon was not how to refine the software productivity metric, but rather how to refine the application of that metric.
  • something missing (Score:3, Insightful)

    by Darth_Burrito ( 227272 ) on Monday March 18, 2002 @02:30PM (#3181972)
    I feel like some intrinsic part of programmer productivity has been overlooked here. A lot of development is done in teams, working with groups of people. Sometimes a person can be of immense support to a team by providing insight, direction, explaining an existing system, etc... without writing a single line of code. I've known some programmers who never wanted to be bothered and others who became so swamped with people asking them questions that they sometimes had trouble getting their own work done. If Bill asks Rick a question, and Bill's answer takes an hour to explain, but saves Rick a day in wasted implementation, how does that affect the perceived productivity of Bill and Rick? Furthermore, how does this make you look at the productivity of someone who never wants to be bothered or someone who rarely asks questions even when they should?
  • Function points? (Score:3, Informative)

    by markmoss ( 301064 ) on Monday March 18, 2002 @02:30PM (#3181975)
    What is needed are metrics for estimating how hard the problem is, not how hard someone worked to solve it. For estimating the cost of writing a program in the first place, there are various measurements of the problem complexity. One is function points. Google found about 10 pages of links. Here is a FAQ [compuserve.com] (not approved by the function point users group) that discusses the use of function points to measure productivity, among other things.
  • by Webmonger ( 24302 ) on Monday March 18, 2002 @02:36PM (#3182010) Homepage
    The article originally appeared here [earthweb.com] last week. Sheesh. Don't pretend it's an original Slashdot article if it's not.
  • by BlackGriffen ( 521856 ) on Monday March 18, 2002 @02:45PM (#3182050)
    For instance, the assumption that lines of code = complexity is false. Ultimately, these are what matters in programming:

    How fast is the compiled program
    How big is the compiled program
    How easy is the source code to read
    How stable is the compiled code
    How secure is the program
    How complete is the feature set

    These are all about software quality, not quantity, though. Once you've measured qaulity, the only measure I can see for quantity is, "Did ya get the job done?" The key to measuring a programmers productivity, I think, is to have the programmer keep a log of what he's doing. With that log, the company can insist on improvement, a maintained level, give bonuses for productivity, etc. The only issue I could see with such a log idea is that the higher ups will become so obsessed with the log, and what the programmer is allowed to claim as a job done in the log, that the programmers won't be able to do their job. Oh, well, it was just an idea.

    BlackGriffen
  • True Productivity (Score:3, Insightful)

    by Bilbo ( 7015 ) on Monday March 18, 2002 @02:52PM (#3182099) Homepage
    I was told by a wise Software Engineer long ago:
    True productivity in software engineering is measured by the number of lines of code removed per day.
  • by cperciva ( 102828 ) on Monday March 18, 2002 @02:56PM (#3182123) Homepage
    If you need comments in order for your code to make sense, you need to rewrite your code.

    My personal measure of coder productivity is as follows:
    1. Take all the produced code.
    2. Remove all the comments.
    3. Present each function to a third party who is unfamiliar with the code, and ask them to explain how it works. If they can't, delete the function.
    4. If you have anything left, remove all formatting except linebreaks, and count the *distinct* lines of code. (Bad coders tends to cut+paste, which would lead to overcounting.)
  • One example (Score:3, Interesting)

    by Pinball Wizard ( 161942 ) on Monday March 18, 2002 @03:03PM (#3182165) Homepage Journal
    At the moment I'm trying to find the best algorithm for finding the common elements between two arrays.


    I could go the easy route and check every array index in the first array against every array index in all the other arrays. For all I know this is the most efficient way to do this.


    But, instead I'm going to research some algorithm books and see if I can't find a more efficient way to retrieve the common elements.


    I may very well end up with something that takes a lot longer to code and has less lines of code than the brute-force compare-every-element-against-every-other-element method. But if the payoff is faster, tighter code, then my research and extra coding time will have paid off. However, to the untrained eye, it may look like I'm spending more time to produce less code.


    If you are a manager reading this, remeber, the best solution may take longer and contain less code than a suboptimal solution! You have to think hard if you are going to try to quantify this - because nobody knows off the top of his/her head what the best algorithm for everything is. If you have a programmer who regularly researches the efficiency of the algorithms they use you will probably end up with a lot happier customers than if you just have people who bang out code without thinking hard about what they are doing. Unfortunately, doing things the right way makes the programmers job harder to quantify.

  • by Greyfox ( 87712 ) on Monday March 18, 2002 @03:07PM (#3182197) Homepage Journal
    I've never worked in a company where lines of code were counted. Generally requirements are specified by the customer, we estimate time to code the requirements and requirements completed is the measurement we tend to go by. Every once in a while we miss one and the schedule gets pushed around. If you never manage to complete a requirement, you're not being a very productive programmer.

    The larger teams also have code reviews, so if a programmer's code leaves something to be desired, they can say so in those meetings and send him off to fix the problems they highlight. Said meetings understand that programmers of varying abilities work on the team, but they allow the team to address the most obvious shortcomings in someone's code.

    A testing cycle is also required to insure that the programmer's not just saying he completed the requirement. Not much point in submitting code as complete if it doesn't operate as per the requirement's specification.

  • by archen ( 447353 ) on Monday March 18, 2002 @03:23PM (#3182301)
    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...
  • ... that Java is better than Perl. It takes so many more lines of code to do the same simple thing. 'splains everything.
  • by iabervon ( 1971 ) on Monday March 18, 2002 @04:41PM (#3182713) Homepage Journal
    You want to measure documentation separately, because it obviously isn't used in the same way as code.

    For the code, the metric you'd actually like is something like number of useful, novel expressions.

    Copying a section of code doesn't add anything, because the lines aren't novel. Any changes you make to the lines do count, though. Making an existing block of code into a separate procedure adds a novel expression, and the expression is useful if you call it from multiple places (i.e., if the procedure is a useful abstraction). Calling a procedure with a new set of arguments is novel and generally useful.

    Basically, you want to know how long the day's work had to be, given the pre-existing code, if it was done optimally.

    If you add a penalty for making the code needlessly long, then a day spent reworking bad code to be shorter by combining common expressions, removing extraneous computation, etc, will also be considered productive.

    For the documentation, it is easier to consider but harder to quantify. You are now measuring the number of correct and useful pieces of information that a person would get out of reading the commented code. The information may, of course, be obvious from the control structure, implied by the variable names, or actually in comments; since comments add to the length of the code without adding any functionality, using coding idioms that the reader will know (because they're part of the company's style guide or common throughout the code) and informative names is better than putting in comments, unless it is impossible (which is frequently the case).

    Of course, it's hard to quantify "pieces of information" and hard to judge objectively what can be gotten out of a block of code, which is one reason this isn't something you can set up cvs to do each day or something.

    This means that the ideal block of code, which should be counted as the most possible for a given problem, has these properties: it (or an equivalent block) has to be there in order for the project to do what it's supposed to do; it is not replicated, in whole or in part, anywhere else in the project (if it did, it would do better to call the other part); its behavior is clear from the names of the procedures, variables, and types; any common algorithms are implemented in the standard ways; and unusual algorithms are commented explicitly.

    I think this metric would measure productivity effectively. Of course, it doesn't help productivity to actually try to measure it.
  • by casmithva ( 3765 ) on Monday March 18, 2002 @04:52PM (#3182779)
    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!

  • Was that all? (Score:4, Insightful)

    by matsh ( 30900 ) on Monday March 18, 2002 @05:01PM (#3182828) Homepage
    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
  • by beanerspace ( 443710 ) on Monday March 18, 2002 @05:56PM (#3183205) Homepage
    A quick trip to the IEEE's online store [computer.org], and about $300 bucks will give you all the gory details you need to measure software quality ... provided you consider that software quality synonyous with programmer productivity.

    For example. In grad school, we took the 1992, IEEE Standard for a Software Quality Metrics Methodology, along with GNU Flex, and wrote a program that would slice-n-dice C & C++ programs against a table of measureable metrics for code readability and reusability.

    Of course, we had a blast testing it against winning entries from the 9th International Obfuscated C Code Contest [ioccc.org]. But we also noticed that there were just some things that it would never be able to test. For exmaple, while our little app spotted code that was uncommented, it could not tell us whether or not the comments were useful or relevant.

    Point is, judging code and productivity is always (or at least until HR offices are equipped with Beowulf's) going to have a subjective element. Because lets' face it, when it comes down to it, many bosses really only care that the job gets done on-time and under-budget.

    Or what's that great line from the movie "War Games" ... Hell, I'd piss on a spark plug if I thought it'd help.
  • by nickynicky9doors ( 550370 ) on Monday March 18, 2002 @09:01PM (#3184295)

    Definition:Productivity, '2 a : the act or process of producing b : the creation of utility; especially : the making of goods available for use.' from Mariam Webster

    Premise: Productivity cannot be measured except by creation of utility. Utility can be defined as a marginal increment of value. Value can be defined as a unit of production. Productivity then is a measure of increased value. Definitions of value have been attempted from Aristotle onward with varying degrees of acceptance. For business purposes value is found in the bottom line and is predicated upon Generally Accepted Accounting Practices.

    If we put aside the idea of a programmer being made to be 'highly' productive as a pipe dream then increments of utility can be put forth as the only available measure of productivity. For example I find I'm more likely to be 'highly' productive the more people like me, do what I want them to do and give me what I want.

    If we accept increased utility as a definition of productivity then the final product as it is defined becomes the final abitrator of value. This implies a Goal oriented approach to value based upon measurable increments to utility. This suggests any one programmer is capable of productivity only in so far as s/he is capable of adding to utility.

    If this simple definition of productivity is looked at from the view point of Open Source an interesting phenomenon arises in terms of the artistry of programmers. The Renaissance and post Renaissance periods produced leaps in Science and the Arts something akin to what we're presently experience. It's been suggested the creation of perspective drawings birthed the industrial revolution by providing schematics that made possible the production of the machinery of industrialization. A critical aspect of the Renaissance and the eras that followed upon it allowed for the free borrowings from the works of others. Those given to 'copyrighting' their material had little recourse, famed lutanists would hide behind curtains so no one could steal their chops. Bach, Shakespeare and others freely borrowed lines and more from their contemporaries and those who came before them. Bringing this rant to a close it remains to postulate whether the Open Source movement, in multipart harmony, provides a more efficient model for productivity? Well doh!

Neutrinos have bad breadth.

Working...