Get Thinking

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

Mull It Over

  1. Are these good variable names? Answer with either yes (explain why, and in what context), no (explain why), or can’t tell (explain why).

    1. int apple_count

    2. char foo

    3. bool apple_count

    4. char *string

    5. int loop_counter

  2. When would these be appropriate function names? Which return types or parameters might you expect? Which return types would make them nonsensical?

    1. doIt(...)

    2. value(...)

    3. sponge(...)

    4. isApple(...)

  3. Should a naming scheme favor the easy reading or easy writing of code? How would you make either easy?

    1. How many times do you write a single piece of code? (Think about it.) How many times do you read it? Your answers should give some indication ...

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.