Definition of how words are formatted and combined when naming things in code.
Details
Different programming languages use specific naming styles, also called case types, to make code easier to read and to distinguish between kinds of identifiers such as variables, functions, and classes.
A naming style defines how words are combined, capitalized, and separated within a name. Following a consistent style improves readability and helps other developers quickly understand your code.
camelCase
The first word starts lowercase, and each following word begins with a capital letter.
playerScore isAlive userName
PascalCase
Each word starts with a capital letter, including the first one.
PlayerScore UserProfile GameSession
snake_case
All letters are lowercase, and words are separated by underscores.
player_score user_name is_alive
UPPER_CASE (Constant Case)
All letters are uppercase, and words are separated by underscores.
MAX_SCORE PI_VALUE DEFAULT_TIMEOUT
kebab-case
All lowercase with words separated by hyphens.
player-score user-profile game-session
Each language community follows its own conventions. For example:
- camelCase – Common in JavaScript, C#, and Java.
- snake_case – Common in Python and Ruby.
- PascalCase – Common for class and type names in many languages.
- UPPER_CASE – Used almost everywhere for constants.
What matters most is consistency: pick the appropriate style for your language and use it consistently throughout your project.