Good comments explain why, not what:
// Bad: increments count
count++;
// Good: retry needed because API occasionally times out
count++;
Don't comment obvious code. Do explain complex logic, workarounds, and non-obvious decisions.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
When and how to comment
Good comments explain why, not what:
// Bad: increments count
count++;
// Good: retry needed because API occasionally times out
count++;
Don't comment obvious code. Do explain complex logic, workarounds, and non-obvious decisions.