TITLE: simple naming conventions (Newsgroups: comp.lang.c++.moderated, 13 Oct 98) [ Naming conventions border on religious issues, but this is a simple one. In a related note, there are coding convention links on http://www.ses.com/~clarke - adc ] MYERS: ncm@nospam.cantrip.org (Nathan Myers) > This is not to say that naming conventions are wrong in general; > anything that cannot be represented in a language must be > represented instead in users' choices, such as in names. Because > C++ makes a very hazy syntactic distinction between variables and > types, it is good practice to make them visibly distinguishable by > (for example) capitalizing type names. KANZE: jkanze@otelo.ibmmail.com I'm 100% in agreement with Nathan on this. About the only thing I "mark" with a special form of name are member variables, which start with "my" for non-static, and "our" for static. Another convention that I use, although pretty vague, is that type names are unqualified nouns (e.g. State), "value" names (i.e. variables and constants) are qualified nouns (e.g. currentState), and function names are verbs (e.g. handleEvent). About the only thing that bothers me are predicates: the functions are fine (e.g. isValid, which is a verb phrase), but the variables just don't sound right without a verb -- simply valid seems ambiguous, and myValid even worse. At present, I'm using myIsValid, but I can't say that I like it.