A class and a method can contain the same word while playing different roles. Distinguish nouns that name things from verbs that name actions, and notice how userName and user_name mark word boundaries. Reading meaning and spelling convention separately makes long identifiers easier to parse.
Key terms
Both forms separate words in a name: camelCase uses capitalization, while snake_case uses underscores.
| Term | Meaning |
|---|---|
naming convention | Classes and types often use noun-based names, while functions and methods often use verbs that describe their action. Variable names should convey the value they hold. Follow the language and project's rules for capitalization, abbreviations, and compound words consistently. |
camelCase / PascalCase | These conventions join words without spaces and mark boundaries with capital letters. camelCase starts with a lowercase first word; PascalCase capitalizes the first word too. Their use depends on the language and project style guide. |
Terms to distinguish
| Term | Meaning |
|---|---|
snake_case | Joins words with underscores (_). It appears in variables, functions, database identifiers, and other names depending on the language and project style guide. |
Hungarian notation | Adds a prefix that indicates a variable's type or purpose. It is not a universal modern rule; you may encounter it in existing code or a team's conventions. |
Terms in code
| Term | Meaning |
|---|---|
g_ / m_ / s_ | Prefixes some projects use for global, member, and static scope, respectively. They are not shared rules across languages, so check the project's convention first. |
Reading a technical document
Even if a class and a method share a word, their noun or verb role and spelling convention help you read their names.
When several unfamiliar terms appear in one sentence, start with the subject and action. Then identify the words that add scope, state, or tools. A long identifier becomes more manageable once you separate its role from its spelling.
Key takeaways
Read an identifier's role and the team's rules before focusing on its shape.
- naming convention — Nouns often name classes and types; verbs often name actions. Choose names and capitalization consistently with the project style guide.
- snake_case — Uses underscores to divide words; where it is used depends on the language and project.
- g_ / m_ / s_ — Project-specific prefixes that may indicate global, member, or static scope.

