News for hackers. Stuff that matters.
Re:Writing Well-Documented Code – Learn from Examples by tpoacher on Sunday September 05, 2021 @04:10AM (#28422429)
To me, comments in code are like descriptions in a novel.

I would agree that comments which unnecessarily describe what is to come are bad, in the same way that a novelist should prefer to show, not tell, unless there is a compelling reason for the reader to keep that description in mind as the immediate events unfold.

But to require almost all comments gone in favour of well-named code and external docs feels wrong too, in the same way that one would probably not like to read a book with no chapter headings, no visuals, simply describing the story in a dry (but informative) language, and relying on cliffnotes for actual context.

And if you say code is more like a technical report than a novel, I will disagree. Good code is always a pleasure to read, and typically for similar reasons that a good novel is pleasurable.

There are no comments on this comment yet.