Identify the Meaning of Each Variable

After you identify the goal of each section, look at the variables used in the code and identify the “meaning” of each one.

The meaning of a variable refers to what value, conceptually, it is supposed to contain.

Variable Names

Variable names, like comments, can be both useful and misleading.

Unlike sections of code, all variables have names, which can usually be counted on to provide some hint of the variable's meaning. A variable's name is like a miniature comment from the programmer that appears every place the variable is used. As with comments, however, you have to make sure that the variable really is used the way the name indicates. Furthermore, some variables, even important ones, have single-letter ...

Get Find the Bug A Book of Incorrect Programs 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.