4 ms·
It's easier to write code than it is to read code. That's why there's so much emphasis on documenting and why someone inevitably writes functions that already e
by muzani 3y ago
It's easier to write code than it is to read code. That's why there's so much emphasis on documenting and why someone inevitably writes functions that already exist.
- kazinator 3y agoWe simply cannot make this generalization. It is obviously false of other creative activity involving writing; it is not harder to read a novel than to write a novel, for instance. However, it's easy for someone to effortlessly spew stream-of-consciousness drivel into their blog, which is painful to read for someone else. It is more or less so with programs. There is one way in which reading is absolutely harder that writing. Writing (a given revision of the code, or any other text) is only done once. Once you have written that, nobody else has to write that ever again. Reading is not like that. Nobody can read it once, so that then nobody else has to read it. Everyone who needs to read it must do it for themselves; explanations and summaries given by others who have read it before only go so far. Even one individual must repeatedly read it in order to get it, after which he or she will forget it anyway with the passage of time. The code doesn't "stay read" the way it stays written; if you come back to it in 25 years, there is nothing to write (other than a new revision, but my point is no need to write the original revision). If you come back to reread something in 25 years, you might as well have never seen it before.