Hacker News new | ask | show | jobs
by beaumartinez 5351 days ago
Comments and readable code aren't mutually exclusive.

> Code should be almost as readable as a book. You should be to read without pausing too much as well as skimming.

I pause much more reading code than I do reading prose.

Trying to keep a lookup table of functions and variables in my head is much harder than reading a few lines of prose to let me know what's going on.

Comments should summarise what's going on, so that when you have a bug, you can jump to the right section to change.

> Comments are almost like an annotation in a book. So use them sparingly.

The way I think of it: Don't use comments to annotate your code. Use code to annotate your comments.