3 ms·
Comments are necessary for a million reasons and the people who argue against them often haven't maintained someone else's code (or even their own). A few: sid
by awinter-py 7y ago
Comments are necessary for a million reasons and the people who argue against them often haven't maintained someone else's code (or even their own).
A few: side effects, ordering that's required for correctness but not checkable by the language, guarding performance tricks from getting deleted.
An unfamiliar person trying to find out where in the codebase a thing happens relies on comments. Comments are much more readable and much more searchable than functions, in the same way that blogposts and comments add semantic terms to web documents to improve search.
Also intent -- to guide us in situations where 'this function is doing undesirable things but I have no idea what it's supposed to do so I can't fix it'.
Yes they get stale if not updated; it's a living spec. But most teams don't update any specs so code & comments are still the best one we have.