Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have often come across claims that source code is read much more than it is written and just wanted to do a little calculation like:

If you write a line that takes me 5 minutes longer to read because you were to lazy to write a comment for 5 minutes it will cost us n*X if 5 minutes of programmer time cost X.

Then I realized that I not only lack n to do the calculation but also have never seen any evidence for the claim that code is read much more than it is written.

Is that just a fishy "well it is only written once so it has to be read a lot more" argument or are there any studies on the subject that you know of?

share|improve this question
2  
Related: industry averages for time spent on maintenance –  MichaelT May 3 '13 at 15:23
3  
"If you spent five minutes writing a comment, you should have spent five minutes making the code so obvious that it didn't need that comment." –  Anthony Pegram May 3 '13 at 15:50
5  
The statement is based on developers' experience. Talk to any average or good developer, they'd most probably confirm that they spend more time reading code than writing it. –  superM May 3 '13 at 15:58
1  
see also: Is “as long as it works” the norm? and What data is available regarding cowboy coding? The latter feels pretty much like an (inverted) duplicate, "how many apps have failed to function as intended / crashed / removed because of errors made by, in essence, sloppy coding... Is there any data about this type of development?" –  gnat May 3 '13 at 23:28

1 Answer 1

For a lower bound, you could look at how many revisions typical files have in your source control. You have to read it at least once in order to make a change. However, if you actually tracked yourself over the day, I think you would find the actual value much higher.

share|improve this answer
    
I should write a Visual Studio plug-in to track how many times a file is opened. :) –  Sarien May 3 '13 at 16:55
1  
@Sarien: And why not make it Tobii-enabled? Not only would you have line-by-line statistics, but even character by character statistics! –  Allon Guralnek May 10 '13 at 18:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.