The basic tension in naming something is the length vs. descriptiveness tradeoff. In general, we try to avoid abbreviations, but really long words like "environment" inevitably get shortened to "Env", etc.
The bulk of the conventions we have established have to do with distinguishing between different categories of names: class type names, member function names, and member names being the major categories. In addition, the way in which names composed of multiple words are formed is discussed.
Class types are first-letter-capitalized with words separated by
capitalization: e.g. MyClass
. There are certain exceptions, where
an underbar '_' is used to attach a high-frequency suffix, usually from
a template, to the name:
Common Suffixes:
_List
_Group
_MGroup
_Array
_SPtr
Also if the class name contains multiple words, words which are actually acronyms ending with a capital letter are separated from the following word by an '_', e.g., (CE_Stat).
Classes in lower-level libraries also have the name-space identifier
prefixed to the name, which is lower case: e.g., ta
, taiv
,
css
.
enum
type names follow the same naming convention as class types.
enum
members are all upper-case, words are separated by '_',
e.g., INIT_STATE
.
Members are lower-case, words are separated by a '_', e.g., member_name. One exception is for names ending in spec or specs in which case there is no separation (e.g., viewspecs).
Methods are first-letter-capitalized, words are separated by
capitalization (e.g., RunThis()
). However, there some special
prefixes and suffixes that are exceptions to this rule, because they are
"high frequency" and denote a whole class of methods:
Prefixes:
Dump_
Compute_
Send_
C_
Init_
Suffixes:
_impl
_xxxx
_
_post
_Copy
_gui
_mc