We have moved to a new website!

If you are not redirected within 3 seconds, click here to go my homepage.

Best practices for writing code comments

1: Comments should not duplicate the code.
2: Good comments do not excuse unclear code.
3: If you can’t write a clear comment, there may be a problem with the code.
4: Comments should dispel confusion, not cause it.
5: Explain unidiomatic code in comments.
6: Provide links to the original source of copied code.
7: Include links to external references where they will be most helpful.
8: Add comments when fixing bugs.
9: Use comments to mark incomplete implementations.

References

Stack Overflow Blog


Read More