Get Thinking

A detailed discussion of the following questions can be found in the "Appendix A" section on page 485.

Mull It Over

  1. How might the need for and the content of comments differ in the following types of code:

    1. Low-level assembly language (machine code)

    2. Shell scripts

    3. A single-file test harness

    4. A large C/C++ project

  2. You can run tools to calculate what percentage of your source code lines are comments. How useful are these tools? How accurate a measure is this of comment quality?

  3. If you come across some incomprehensible code, which is the better way to factor in some intelligibility: adding comments to document what you think is going on, or renaming variables/functions/types with more descriptive names? Which approach will most likely be easier? ...

Get Code Craft now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.