Naming Conventions
Consistent naming reduces mental mapping and makes codebases easier to scan. These rules apply to all projects, with the language-specific sections below.
3.1 General Rules
Use English for all identifiers. Domain-specific abbreviations are allowed only when widely understood by the team and documented.
Choose meaningful, descriptive names that reveal intent. Avoid single-letter names except for loop counters (
i,j,k) or well-known mathematical contexts.Do not use abbreviations unless they are universally recognized (e.g.,
Id,Url,Http,Xml). When in doubt, spell it out.Avoid Hungarian notation and type prefixes (e.g.,
strName,iCount). Type information should come from the type system.Do not encode scope or visibility in the name (no
m_,s_,g_for member/static/global). Use language features (e.g.,this.,_prefix for private fields) where appropriate.Distinguish names only by case if they serve different roles (e.g.,
uservariable vsUserclass), but avoid confusing siblings in the same scope.