Place Comments Close to the Code They Apply To
Placing comments close to the code they apply to has several benefits for readability and maintainability. The following sections cover ways you can shoot for these benefits as you write comments:
- Keep Comments Close to the Corresponding Code [DS19]
- Consider Documenting Blocks of Code Rather than Individual Lines [DS20]
- Intersperse Comments with Individual Lines If That Eases Comprehension [DS21]
- Don’t Have Blank Lines Between Comments and the Code They Apply To [DS22]
- Leverage Re-usable Documentation Techniques for High-Level Documentation [DS23] [WHERE]