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 do use abbreviations, keep track of abbreviations in a project dictionary or use the standardized prefixes approach. Code is read far more times than it is written. Be sure that the names you choose favor read-time convenience over write-time convenience.
|
No comments:
Post a Comment