Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Fixing unmaintainable code with guaranteed to be unmaintained comments is a losing cause. To the extent possible, you should not duplicate logic in code and comment.

I find that I comment for three reasons. 1) To make clear what the public API is that shouldn't change versus what can change at any time. 2) To comment on non-obvious but important details of other APIs that I am calling. 3) To give a very general overview of the code.

But NEVER do I put comments of the form, "This part does this, and that part does that." If I feel tempted, well, maybe I've discovered a function that I want to use instead...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: