Re: Best practices for writing code comments

10 months ago

Hey Buddy.

I found 9 Rules for writing comments on code.

Rule 1: Comments should not duplicate the code.

Rule 2: Good comments do not excuse unclear code.

Rule 3: If you can’t write a clear comment, there may be a problem with the code.

Rule 4: Comments should dispel confusion, not cause it.

Rule 5: Explain unidiomatic code in comments.

Rule 6: Provide links to the original source of copied code.

Rule 7: Include links to external references where they will be most helpful.

Rule 8: Add comments when fixing bugs.

Rule 9: Use comments to mark incomplete implementations.

Interested? Read more: https://stackoverflow.blog/2021/07/05/best-practices-for-writing-code-comments/