Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How many lines of code can you write?
3 points by hashtable on Jan 28, 2008 | hide | past | favorite | 5 comments
How many lines can you write and in what language? I can write about 200 lines of Python per day and am feeling that I don't write fast enough. What are your experiences?



I don't keep track of how many lines of code I write and subsequently delete; but here's the month-to-month changes in the total number of lines of code for my online backup code (http://www.tarsnap.com) throughout 2007, as measured by sloccount:

  January    +994
  February  +1291
  March      +691
  April     +1318
  May       +1431
  June      +1430
  July      +1497
  August    +2098
  September   -55
  October   +1392
  November   +618
  December   +934
In total, on December 31st 2007 I had 13639 more lines of code than I had on January 1st; that works out to 1137 lines/month, or 37 lines/day. (Yes, in September I wrote a negative number of lines of code: The 2098 lines of code I wrote in August included many common idioms, and in September I refactored those out into generic functions.)

I've commented before (http://www.daemonology.net/blog/2007-06-21-think-before-codi...) that anyone who is consistently writing more than 5,000 lines of code per month is either writing trivial code or writing garbage; I think a 1000 - 1500 lines of good quality code per month is a reasonable target (at least as far as C coding is concerned -- I don't have enough data on other languages).

Assuming that Python doesn't vary wildly from C in terms of the amount of thinking required per line of code, I'd say that at 200 lines/day the danger is more likely one of not writing high enough quality code, not one of not writing fast enough.

Edit: It's also worth pointing out that, as Dijkstra commented, "we should not regard [lines of code written] as 'lines produced', but as 'lines spent'" -- given two solutions to the same problem, the one which uses fewer lines of code is generally cleaner and easier to maintain, since it will have less duplication and more layers of abstraction.


I spend some time first thinking about what I want to write and with a paper and pencil do some pseudo code, data model, etc. so when it comes to writing the code, for the most part the buddle-neck becomes my typing speed and syntax error. So in a day I loose about 1 hour planning, 2 hours looking out the window, 2 hours of rethinking and stuff, and about 5 hours typing. and about 3 hours rewrting and making things smaller...

if I don't plan (and sometimes I don't because I get lazy) my productivity drops to about 3 hours worth of typing.

oh and I code in java.

Of course there are days when I do really poor job and days when I even surprise myself.

Lines of code is not important at all elegant and reusable code is.


I must really suck, because between half and 98% of my programming time is spent making lines of code disappear. I seem to have some kind of horribly mistaken impression that I'm doing a good job when the code is more readable, more modular, more functional, and more succinct, all at the same time. I guess you must know something I don't.


Smug.


Python is a fun language to code in. I probably net five, ten max, good lines per hour.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: