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.
Categories: development coding, debugging, Fred Brooks, productivity, programming, software, software root


So what about if im a abad programer AKA script kiddy how do i change??
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.
@Avaladarack
You’re a mechanic on the last day?
Ten lines per day??? Come On Man. A good programmer will produce at least 600 lines of code (this does not include program documentation).
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).
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.
Thanks for the post, inspiring.
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
@ 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?
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.
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!
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.
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?!?
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.
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.
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.
都是英文。。看不懂啊。。。。。。。。。没中文吗。。。。。。。。
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.