Re:Stop Commenting Your Code
by cgore on Friday December 01, 2017 @02:44PM
(#15826696)
I could ... but I'd rather not comment too much :D
[ Parent
| on HN ]
More seriously: yes, you should name functions/variables/etc. reasonably. And often if you write a comment, you will find you are actually explaining away a wart. But often you need to document business logic, code that needs to be written in a less than clear way for performance reasons, explanations of why you chose approach A instead of what would seem like another perfectly reasonable approach B, URL links for standard doc PDFs, and a million other little things.
There are comments that aren't necessary if you write your code better, but there's others that are needed even if you write your code perfectly.