Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
This chapter is about writing comments that pack as much information into as small a space as possible. Here are the specific tips:
Avoid pronouns like “it” and “this” when they can refer to multiple things.
Describe a function’s behavior with as much precision as is practical.
Illustrate your comments with carefully chosen input/output examples.
State the high-level intent of your code, rather than the obvious details.
Use inline comments (e.g., Function(/* arg = */ ... ) ) to explain
mysterious function arguments.
Keep your comments brief by using words that pack a lot of meaning.