发表于2004/9/30 22:26:00 604人阅读
分类： Excerpt of CC2
1. Express exact meaning.
2. As short as possible.
Naming Loop Indexes
In common, we can use the names such as i,j and k; but when loop is long and complex, we should use a meaningful name like recordCount.
Naming Status Variables
Think of a better name than flag for status variables.
Naming Temporary Vriables
In one way or another, most of the variables in your program are temporary. Calling a few of them temporary may indicate that you aren't sure of their real purpose. So also give it a meaningful name.
Naming Boolean Variable
Give boolean variables names that imply True of False, such as Is....
Use positive boolean variable names.
Naming Enumerated Types
Give a group prefix to these variables.
Conventions for names
1. Differentiate between variable and routine name.
variable name is begin with lower case and routine name with upper case.
2. Differentiate bwtween clases and objects
Differentiating them via initial Capitalization.
3. Identify global variables
use g_ prefix.
4. Identify member variables.
use m_ prefix.
5. Identify type definitions
prefix the type names before the variable.
6. Format names to enhance readability.
Two common techiniques for increasing readability are using capitalization and spacing characters to separate words.
Comments on Abbreviations
1. Don't abbreviate by removing one characters from a word.
2. Abbreviate consistenly.
3. Create names that you can pronounce.
4. Avoid combinations that result in mispronunciation.
5. Use a thesaurus to resolve naming collisions.
6. Document extremely short names with translation tables in the code.
7. Document all abbreviations in a project-level "Standard Abbreviations" document.
Kinds of Names to Avoid
1. Avoid misleading names or abbreviations.
2. Avoid names with similar meanings.
3. Avoid variables with different meanings but similar names.
4. Avoid names that sound similar.
5. Avoid numberals in names.
6. Avoid misspelled words in names.
7. Avoid words that are commonly misspelled in English.
8. Avoid names containing hard-to-read characters.
Browsing for ODBC Data Source Names (DSN)浏览ODBC数据源名字
chenxh 2006-02-23 09:05 14
QIBAOYUAN 2013-08-21 16:21 2406
set names utf8.doc
qq_35151406 2016-06-30 15:41 0
rushuinianhua 2013-08-20 17:22 454
gp0128 2009-09-19 11:02 1
Codeforces Round #405 C. Bear and Different Names
overload1997 2017-03-20 23:24 138
RotateRotate Common Names: Rotation Brief Description The rotation operator performs a geometric
rocky69 2012-08-03 23:30 595
Codeforces Round #405 C.Bear and Different Names【思维】
mengxiang000000 2017-03-19 12:26 648