Home > development > Some lesser-known truths about programming

Some lesser-known truths about programming

My experience as a programmer  has taught me a few things about writing software. Here are some things that people might find surprising about writing code:

  • A programmer spends about 10-20% of his time writing code, and most programmers write about 10-12 lines of code per day that goes into the final product, regardless of their skill level. Good programmers spend much of the other 90% thinking, researching, and experimenting to find the best design. Bad programmers spend much of that 90% debugging code by randomly making changes and seeing if they work.
    “A great lathe operator commands several times the wage of an average lathe operator, but a great writer of software code is worth 10,000 times the price of an average software writer.” –Bill Gates
  • A good programmer is ten times more productive than an average programmer. A great programmer is 20-100 times more productive than the average. This is not an exaggeration – studies since the 1960′s have consistently shown this. A bad programmer is not just unproductive – he will not only not get any work done, but create a lot of work and headaches for others to fix.
  • Great programmers spend little of their time writing code – at least code that ends up in the final product. Programmers who spend much of their time writing code are too lazy, too ignorant, or too arrogant to find existing solutions to old problems. Great programmers are masters at recognizing and reusing common patterns. Good programmers are not afraid to refactor (rewrite) their code constantly to reach the ideal design. Bad programmers write code which lacks conceptual integrity, non-redundancy, hierarchy, and patterns, and so is very difficult to refactor. It’s easier to throw away bad code and start over than to change it.
  • Software obeys the laws of entropy, like everything else. Continuous change leads to software rot, which erodes the conceptual integrity of the original design. Software rot is unavoidable, but programmers who fail to take conceptual integrity into consideration create software that rots so so fast that it becomes worthless before it is even completed. Entropic failure of conceptual integrity is probably the most common reason for software project failure. (The second most common reason is delivering something other than what the customer wanted.) Software rot slows down progress exponentially, so many projects face exploding timelines and budgets before they are killed.
  • A 2004 study found that most software projects (51%) will fail in a critical aspect, and 15% will fail totally. This is an improvement since 1994, when 31% failed.
  • Although most software is made by teams, it is not a democratic activity. Usually, just one person is responsible for the design, and the rest of the team fills in the details.
  • Programming is hard work. It’s an intense mental activity. Good programmers think about their work 24/7. They write their most important code in the shower and in their dreams. Because the most important work is done away from a keyboard, software projects cannot be accelerated by spending more time in the office or adding more people to a project.

  1. Zentdayn
    November 14th, 2010 at 17:19 | #1

    So what about if im a abad programer AKA script kiddy how do i change??

  2. Avaladarack
    November 18th, 2010 at 18:45 | #2

    the 10 lines per day thing is an over simplification.

    The first day of the project, you can easily exceed the 700 lines per programmer.

    The last day, adding more lines is a complete faliure. You should only be fixing bus.

  3. JustKidding
    November 19th, 2010 at 15:20 | #3

    @Avaladarack
    You’re a mechanic on the last day?

  4. Allan
    November 23rd, 2010 at 16:46 | #4

    Ten lines per day??? Come On Man. A good programmer will produce at least 600 lines of code (this does not include program documentation).

  5. Tim
    November 25th, 2010 at 17:25 | #5

    i have to say that on larger projects, the 10 lines per day is a good average. consider a small function that does something important but relatively complex. you may fiddle around with that one function for two or three days getting it just right. you may have rewritten it countless times but in after 3 days, it’s only 30 lines. if you are writing 600 lines of code in one day, then your project was probably trivial and already implemented very well by someone else (or by you some other time).

  6. Yogesh
    November 26th, 2010 at 01:27 | #6

    Thanks for this article full of Knowledge behind coding.
    Reading books and attaining lectures gives information about subjects but knowledge is what person have after understanding and thinking on subject.Great programmers do that.

  7. Dan
    January 15th, 2011 at 23:16 | #7

    Thanks for the post, inspiring.

  8. February 23rd, 2011 at 12:44 | #8

    Hi David,
    I found your article very interesting and I would be very interested in translating it in French in order to cross post it in my blog.

    Can you tell me email if you do agree ? of course, I will quote you as the original author and give link to your post.

    Greetings
    Akram

  9. liam09
    April 8th, 2011 at 07:52 | #9

    @ Allan
    lol, that is funny – 600 lines a day? Prove that to me, and I will hire you at a six figure salary. I have been programming for close to 20 years and the 10-20 lines/day quote is pretty standard in the industry. However, 600 lines/day is not (seriously, 600? why didn’t you just pick 500? or did the extra 100 make it sound like you know your stuff?). Unless you are writing your code in a language that requires each letter to exist on a new line, you are /not/ writing 600 lines of code a day.
    If you are a programmer (which I have doubts), and no – dreamweaver html doesn’t count – you are either very disalusioned about your work ethic, or are an entry level programmer still working on a CS degree. I remember hearing the 10-20 lines a day statistic and thinking ‘no way that is true.’ It is very true. You can easily spend a week figuring out how to use SOAP to interface an internet gateway, configure the correct request and parse the corresponding result. In addition to that, many errors slip through the cracks in documentation and little nuances become the biggest time killers. For example, back before windows had transparent backgrounds, I was trying to make my own using the layeredwindow api. I spent easily two weeks trying to figure out how to manipulate a png image by using per pixel rendering in GDI+ and then passing that handle to the layeredwindows call without any luck. One day I literally changed a 0 to a 1 and I created a transparent form with perpixel alpha blending. Now adding controls to the form was another thing, but that easily proves that I was working on less than 10 lines of code a day for almost a month. Some days I think I was at -10 lines of code. Or 1 line of code, and as I just mentioned – 1 character of code.
    Good luck keeping up with your standard of 600 lines of code a day. Send me your info, and I will hire you through oDesk where I can track exactly how much work is being done. You keep up that 600 lines of code/day average for 1 week, and I will hire you full time
    Deal?

  10. Roy
    April 21st, 2011 at 13:39 | #10

    Great post!

    Until a few months ago, I did not believe there was such a thing as a “bad programmer”. I have worked with “weak” programmers, but I always felt that even the weakest programmer could still contribute.

    Now, I BELIEVE! I hired into this company one year ago and most of the bugs I have to fix are the result of one programmer who got fired after being here for 5 years. Forget writing 10-12 lines of code a day, I do not consider my day to be productive unless I can delete 10-20 lines of code this guy wrote. Sometimes I can delete whole paragraphs without adding or editing any lines, that is how much useless garbage he left in.

    All of that means little. What really matters is: For 5 years this guy negatively impacted this company’s products. For 5 years the other ~100 employees (not to mention our customers) were handicapped by the poor code this guy wrote. I have to wonder how much more market share, how many more happy customers, and how much more profit we would have today had he never been here. :(

  11. May 5th, 2011 at 05:24 | #11

    I agree. Programmers perform an important function without which today’s society could not exist. It’s also true that the really good ones never stop thinking about it and how to improve it.

    I am confident of this because, as a technical writer, some of my closest friends and associates have been programmers. Of course, I wouldn’t want my sister to marry one… ROFLMAO!

  12. Pat Pattillo
    June 1st, 2011 at 23:43 | #12

    All true. These things make it all the more important for a good or great programmer to find the right environment/employer. All too many drive developers to churn out code without thinking. Those who have been around the block a few times resist but the neophytes learn bad habits that prevent them from ever becoming good developers. The stuggle between those who know and bean counters who lack an appreciation of the process exists in all technical realms, not just software. While the rubber does have to meet the road at some point and there is a happy medium my guess is that 30-50% of companies do drive projects this way. It’s not as productive but the “dirt” is easily swept under the carpet because no one knows any better.

  13. Paul d’Aoust
    August 15th, 2011 at 12:27 | #13

    I liked this article; it made me feel like I wasn’t such a bad programmer after all! :-)

    @Russ: I like what you said about the sort of person who asks uncomfortably insightful and incisive questions like a five-year old or an obsessive-compulsive would. I often find myself doing that when I’m talking with clients :-)

    @Shane: I definitely find that I have a limit as well — nowadays, I won’t do any coding past 10 o’clock, and I have to discipline myself to not think about a project if I wake up in the middle of the night. It’s just not worth it to lose a whole night of sleep over good architecture.

    However, my ‘programming muse’ often speaks most clearly to me when I was either asleep or half-asleep, and I tend to discover the most elegant solutions during those times (probably because my superego isn’t busy second-guessing me all the time). So what’s a fella to do?!?

  14. Parker
    August 19th, 2011 at 01:53 | #14

    This article is so true. About the 600 lines comment, I have definitely produced more than that in a single day before, but I doubt anyone has ever averaged even close to that. It really depends on whether you’re solving a problem or just doing a simple task that takes a ton of code. In my case I was overhauling all my drawing code because I discovered a more optimal way of doing it.

  15. Juan
    August 26th, 2011 at 16:15 | #15

    10 lines or 600 lines. It entirely depends on what kind of software are you writting and the kind of problems are you resolving. There are software made of easy problems resolved and software made of really hard problems. So resolving easy problems you could easily reach 600 lines in a day, but resolving a really difficult problem 10 lines of successful code would pay the day.

  16. September 1st, 2011 at 22:34 | #16

    Writing 10 to 20 new lines is probably accurate.

    I like the comment about deleting lines. If I can make the code smaller and accomplish the same thing, then it is usually easier to read, and easier to maintain.

    By deleting, I usually mean removing 20 lines and replacing them with 4. Or removing duplicate code and merging it into one more efficient object or function and replace the duplicates with it.

    I’m always deleting my co-workers code.

  17. 看不懂啊
    September 22nd, 2011 at 02:40 | #17

    都是英文。。看不懂啊。。。。。。。。。没中文吗。。。。。。。。

  18. Jordan Miles
    December 20th, 2011 at 09:54 | #18

    The number of lines really don’t matter. What matters is the quality of code you deliver. Since I started working with Cocoa I stopped trying to measure my performance or the quality of the code i write based on the number of lines.

Comment pages
1 2 3 4 291
  1. August 20th, 2010 at 10:06 | #1
  2. August 20th, 2010 at 17:15 | #2
  3. August 21st, 2010 at 08:05 | #3
  4. August 21st, 2010 at 22:43 | #4
  5. August 23rd, 2010 at 11:15 | #5
  6. August 23rd, 2010 at 14:01 | #6
  7. August 24th, 2010 at 05:26 | #7
  8. August 24th, 2010 at 15:11 | #8
  9. August 24th, 2010 at 19:38 | #9
  10. August 25th, 2010 at 08:10 | #10
  11. August 25th, 2010 at 10:19 | #11
  12. August 25th, 2010 at 14:55 | #12
  13. August 26th, 2010 at 00:31 | #13
  14. August 26th, 2010 at 08:17 | #14
  15. August 26th, 2010 at 22:13 | #15
  16. August 28th, 2010 at 10:41 | #16
  17. August 29th, 2010 at 23:32 | #17
  18. August 30th, 2010 at 08:31 | #18
  19. August 30th, 2010 at 12:31 | #19
  20. September 2nd, 2010 at 23:36 | #20
  21. September 4th, 2010 at 04:13 | #21
  22. September 5th, 2010 at 05:04 | #22
  23. September 5th, 2010 at 07:41 | #23
  24. September 5th, 2010 at 08:00 | #24
  25. September 6th, 2010 at 04:39 | #25
  26. September 8th, 2010 at 00:26 | #26
  27. September 13th, 2010 at 05:19 | #27
  28. September 16th, 2010 at 07:45 | #28
  29. September 20th, 2010 at 00:00 | #29
  30. September 27th, 2010 at 17:19 | #30
  31. October 20th, 2010 at 09:27 | #31
  32. November 5th, 2010 at 10:46 | #32
  33. November 8th, 2010 at 19:04 | #33
  34. November 19th, 2010 at 02:42 | #34
  35. November 20th, 2010 at 21:51 | #35
  36. November 21st, 2010 at 04:04 | #36
  37. January 24th, 2011 at 12:20 | #37
  38. March 27th, 2011 at 22:09 | #38
  39. April 3rd, 2011 at 08:08 | #39
  40. April 4th, 2011 at 11:09 | #40
  41. April 4th, 2011 at 17:45 | #41
  42. April 7th, 2011 at 09:43 | #42
  43. April 7th, 2011 at 19:41 | #43
  44. April 22nd, 2011 at 08:13 | #44
  45. April 30th, 2011 at 06:16 | #45
  46. May 2nd, 2011 at 20:06 | #46
  47. May 3rd, 2011 at 20:33 | #47
  48. May 5th, 2011 at 01:32 | #48
  49. May 7th, 2011 at 13:24 | #49
  50. May 9th, 2011 at 09:30 | #50
  51. June 24th, 2011 at 21:01 | #51
  52. June 25th, 2011 at 10:57 | #52
  53. July 10th, 2011 at 21:08 | #53
  54. August 2nd, 2011 at 20:37 | #54
  55. August 18th, 2011 at 05:16 | #55
  56. October 3rd, 2011 at 22:24 | #56
  57. October 20th, 2011 at 11:10 | #57
  58. October 20th, 2011 at 11:17 | #58
  59. October 20th, 2011 at 11:19 | #59
  60. October 20th, 2011 at 11:19 | #60
  61. October 20th, 2011 at 11:27 | #61
  62. October 20th, 2011 at 11:29 | #62
  63. October 20th, 2011 at 11:42 | #63
  64. November 18th, 2011 at 10:57 | #64