News for hackers. Stuff that matters.
Re:On Comments in Code by ithronmellon on Tuesday June 15, 2021 @02:55PM (#27519884)
What belongs in comments describing API methods, why belongs everywhere else.
Re:On Comments in Code by CodeMage on Tuesday June 15, 2021 @04:36PM (#27521165)
The point on API methods is incredibly important. True, "Why" is the most important kind of comment, but I disagree with the author's critique of the documentation-generating comments and agree with you.

Yes, "what" comments are a source of additional developer effort and of possible inconsistencies between code and comments, but good API documentation is worth writing and maintaining.

No matter how well you name your method and its arguments, if it's part of the public API and you don't include a comprehensive documentation comment, I'll be forced to dig through your source.

Re:On Comments in Code by pc86 on Tuesday June 15, 2021 @03:08PM (#27520055)
If it's impossible to make "what" clear through the code itself.
Re:On Comments in Code by iudqnolq on Tuesday June 15, 2021 @06:03PM (#27522110)
With a public API it's important to distinguish "currently true from reading the code" and "promised to stay true through minor updates". What comments are useful for that
Re:On Comments in Code by gbear605 on Tuesday June 15, 2021 @05:52PM (#27521981)
If a method is part of an API that might be used by developers external to your team, they don’t want to be looking through your code to figure out how to use your methods.