How much code can a coder code?

Lines of code (LOC) is a simple way to measure programmer productivity. Admittedly it is a flawed metric. As Bill Gates famously said “Measuring programming progress by lines of code is like measuring aircraft building progress by weight”. But it is at least easy to measure.

So how much code do programmers average per day?

  • Fred Brooks claimed in ‘The Mythical Man-Month’ that programmers working on the OS/360 operating system averaged around 10 LOC per day.
  • Capers Jones measured productivity of around 16 to 38 LOC per day across a range of projects.
  • McConnell measured productivity of 20 to 125 LOC per day for small projects (10,000 LOC) through to 1.5 to 25 LOC per day for large projects (10,000,000 LOC).

It doesn’t sound a lot, does it? I’m sure I’ve written hundreds of lines of code on some days. I wondered how my productivity compared. So I did some digging through my own code. In the last 12 years I have written somewhere between 90,000 and 150,000 C++ LOC (depending on how you measure LOC) for my products: PerfectTablePlan, Hyper Plan and Keyword Funnel. This is an average of round 50 lines of code per working day. Not so different from the data above.

I also looked at how PerfectTablePlan LOC increased over time. I was expecting it to show a marked downward trend in productivity as the code base got bigger, as predicted by McConnell’s data. I was surprised to see that this was not the case, with LOC per day remaining pretty constant as the code base increased in size from 25k to 125k.

loc

Some qualifications:

  • I give a range for LOC because ‘line of code’ isn’t very well defined. Do you count only executable statements, or any lines of source that aren’t blank?
  • My data is based on the current sizes of the code bases. It doesn’t include all the code I have written and then deleted in the last 12 years. I have just spent several months rewriting large parts of PerfectTablePlan to work with the latest version of Qt, which involved deleting large swathes of code.
  • It doesn’t include automatically generated code (e.g. code generated by the Qt framework for user interfaces and signals/slots code).
  • I only counted code in products shipped to the user. I didn’t count code I wrote for licence generation, testing etc.
  • All the code is cross-platform for Windows and Mac, which makes it more time consuming to write, test and document.
  • Programming is only one of the things I do. As a one-man-band I also do marketing, sales, QA, support, documentation, newsletters, admin and nearly everything else. I have also done some consulting and training not directly related to my products in the last 12 years.

Given that I probably spend less than half my time developing (I have never measured the ratio), my productivity seems fairly good. I think a lot of this may be the fact that, as a solo developer, I don’t have to waste time with meetings, corporate bullshit and trying to understand other people’s code. Also writing desktop Windows/Mac applications in C++ is a lot easier than writing an new operating system with 1970s tools.

50 lines of code per day doesn’t sound like a lot. But the evidence is that you are unlikely to do much better on a substantial project over an extended period. Bear that in mind next time you estimate how long something is going to take.

If you have data on LOC per day for sizeable projects worked on over an extended period, please post it in the comments. It will only take you a few minutes to get the stats using Source Monitor (which is free).

 

 

 

 

 

 

5 thoughts on “How much code can a coder code?

  1. Vasudev Ram

    Interesting post, Andy. I’ve read The Mythical Man-Month, a bit of Capers Jones’ writings, and some books by Steve McConnell. IIRC ,one or more of them were referring to lines of debugged, tested code, with that metric. (I know you are too, about your own,) But yes, I agree it does seem low, intuitively [1], and also that it is likely close to realistic.

    [1] When I first read about it in or or more of those books, I thought, surely it is too low. I’ve written many more lines of code on some days than that. But when you consider it as working code, things start to look different.

    One thing, though, there will be a lot of variation, depending on the complexity of what you are writing. If, for example, you are churning out some simple SQL-based reports (stand-alone or embedded in some programming language), then, even if there are a lot of variants of them [2], you can write many more lines than the quoted numbers, I’d say.

    [2] I’ve been in that situation a few times – having the assignment of churning out lots of SQL reports, varying a good amount in the tables, queries, parameters passed, etc. but still not too complex on the whole. In fact, after a while, I developed a sort of system for it (sort of sorting and classifying them by similarity and difference, and reusing as much code as possible, so it was like I only had to write the delta between the previous report and the next), and found that it then went a good amount faster, and still with correct code :)

  2. shobhitbakliwal

    One metric to measure productivity which I use in my company is to look at tasks and see how many of them were completed by the programmer on time based on the estimates provided earlier.

    This is still hard to measure, but I’ve been able to “see” high productivity and low productivity being proportional to values calculated using this method.

  3. Espen

    As a solo developer, your LoC per day per person will probably be higher than a large team of developers, because you spend less time figuring out how someone else wrote some part of the code base. At least that is my experience with larger teams.

  4. Andy Brice Post author

    3 other developers with a similar situation to mine (substantial codebase written by solo developer, while also running the business) reported LOC/day of : 54, 60 and 68. So it seems my numbers are not an outlier.

Comments are closed.