Key Points

  • Good variable names are a key element of program readability. Specific kinds of variables such as loop indexes and status variables require specific considerations.

  • Names should be as specific as possible. Names that are vague enough or general enough to be used for more than one purpose are usually bad names.

  • Naming conventions distinguish among local, class, and global data. They distinguish among type names, named constants, enumerated types, and variables.

  • Regardless of the kind of project you're working on, you should adopt a variable naming convention. The kind of convention you adopt depends on the size of your program and the number of people working on it.

  • Abbreviations are rarely needed with modern programming languages. If you ...

Get Code Complete, 2nd Edition 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.