5

I have often heard or read the expression, "code is written once but read many times". I think this is a fairly well-known principle of software development. But I have no idea with whom to credit with the notion.

Its not hard to find references which use it, but I don't think I've ever seen a citation or credit given. It could be someone well known (e.g., Donald Knuth? Douglas Hofstadter? "Gang of Four"?) or less well known but deserving recognition for the insight.

Examples of usage:

Code is read much more often than it is written, so plan accordingly...

(Raymond Chen article )

...the ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code.

(Robert C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship)

Wording varies, but its the same idea.

I guess its possible that the original statement of this idea predates computer programming. Artifacts such as cooking recipes, circuit diagrams, architectural plans, etc. probably share the same principle. But still, someone had to eventually recognize the application to source code and write about it or otherwise popularize the idea.

  • In example 1 it is not used as a quote from someone else, it is just a statement of a fact. In the second example the source of the quote is given. – UncleBod Jul 24 at 16:19
  • 1
    @UncleBod the second is a list of quotes from a certain book, and this happened to be one of them. Its not presented as the origination of the saying. – UuDdLrLrSs Jul 24 at 16:20
  • 3
    Regarding the close votes - does this not fall under "computing history and persons with a historic relation to computing" which is explicitly on-topic? Or is there some other reason for the close votes? Some feedback would be welcome. – UuDdLrLrSs Jul 25 at 1:04
  • 2
    Given that it's a current computer science principle, Computer Science stack exchange might be worth considering. – JdeBP Jul 25 at 10:02
  • 1
    @hippietrail thanks for looking, I'll post on meta and see what people think. I'm not too familiar with the CS site myself. – UuDdLrLrSs Jul 25 at 12:44
10

I don't have a definitive answer (I doubt anybody can--any citation is subject to others finding older citations), but the first time I heard it pointed out frequently was when Ada 83 was being designed.

Although it doesn't say it quite the same way, the Ada 83 Language Reference Manual (LRM) does say:

The need for languages that promote reliability and simplify maintenance is well established. Hence emphasis was placed on program readability over ease of writing.

[emphasis added]

Although it's stating it slightly differently, this clearly reflects the same basic idea.

At the same time, it makes clear that this is not a new observation--that it is already "well established". As such, I'd guess there's at least a decent chance of somebody finding a still older reference to at least the same general idea, if not identical wording.

I suppose there's also room for question about exactly how close to the same something has to be to qualify as an older reference. Just for example, in the preface to Algorithms + Data Structures = Programs, Niklaus Wirth mentions:

This is particularly true of the relatively involved and long examples of programs. Their inclusion in this book is not accidental. Longer programs are the "normal" case in practice, and they are much more suitable for exhibiting that elusive but essential ingredient called style and orderly structure. They are also meant to serve as exercises in the art of program reading, which too often is neglected in favor of program writing.

This doesn't specifically mention how much/often code is read vs. written, but clearly points toward the fact that he viewed reading code as having greater importance than it often treated as having.


Algorithms + Data Structures = Programs, Niklaus Wirth, 1976

| improve this answer | |
  • 1
    On a side note, it was already part of the specification for Algol58 (at that time called IAL). From the 1958 Zürich conference papers : "The syntax of the language should be as close as possible to standard mathematical notation, and programs in it should be readable with little further explanation." Wirth, who studied at the time in Zürich created Algol W in 1966 so I guess the idea was there already way before Ada. – Raffzahn Jul 25 at 20:03

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