Lines of code, per developer, per day

I have recently embarked on my largest ever development project. I am roughly 45,000 lines of code into the project (Only counting C#) and am expecting it to hit at least 50,000 by the time its completed.

At the beginning of each Monday I have logged and plotted the amount of lines of C# code completed in the prior week. I have only plotted C# lines because the tool I was using unfortunately only supported this. I have since upgraded to a program called Microsoft Line Of Code Counter and this provides a much more comprehensive report (and its free).

Although the project isn’t finished (And I will update once it is) a couple of interesting results have already surfaced.

  1. It appears that an individual programmers peak output on a completely blank canvas is still limited to roughly 400 lines of code per day.
  2. There appear to be clear peaks and troughs where there are productivity bursts and lulls.
  3. Its unlikely that many programmers could output significantly more than 100,000 lines of code per year.
  4. There gets a point where you’re no longer contributing significant amounts of code in a project but rather fixing what is already there.

However obviously all of this assumes that my work is representative of most programmers, that the type of work is similar (in this case developing a very straightforward business web app – I’m sure you wouldn’t get the same results in one of Microsoft’s or Google’s labs) and as I said above doesn’t take into account the fact that this only counts pure C# lines and none of the other files that were a significant part of this project (aspx, js, asax, css and others).

Here is current chart for anyone interested



(Note that roughly the first 3-4 weeks of this project were only on a part time basis)

Phone number parsing is a bitch

Having spent the last couple of weeks looking for a decent implementation of a generic phone number parser that works with international numbers I’ve continually come up short.

I finally started writing my own custom one when lo and behold I happen to stumble across an awesome C# port of the library that Google uses in its Android platform to parse phone numbers.

Not only will this library support a format like +61 03 9123 1234 but can also understand extensions like this +61 03 9123 1234 ext 1234

Here is the original Java code:

And the C# port:

While I definitely don’t think its perfect and structurally ugly (in my opinion as a result of being a Java clone), its damn near close and building anything nearly as good would be a significant effort.

JSLinq Sum method

JSLINQ is an awesome library that attempts to mimic the functionality provided by .NET LINQ libraries in clientside javascript code.

However while it is a great implementation it lacks a Sum method so for anyone interested here is the Sum method for JSLINQ that I created…

Sum: function (clause) {
    var values = this.Select(clause).ToArray();

    if (values != null) {
        var result = 0;

        for (var i = 0; i < values.length; i++) {
            var val = values[i];
            if (!isNaN(parseFloat(val)) && isFinite(val)) {
                result = result + parseInt(val);

        return result;
    } else {
        throw new Error("Argument Null Source");