Back to all guides Guides

A Developer's Guide to Naming Conventions

How you name variables, functions and files may look like a matter of taste, but it is really a rule that shapes your team's productivity and the readability of your code.

Why naming conventions matter

Code is read far more often than it is written. A consistent naming convention helps others, and your future self, understand the code quickly.

When the rules are uniform, a name alone hints at whether something is a variable, a constant or a class, cutting down on wasted searching.

The main formats at a glance

Conventions by language and context

Many languages recommend their own conventions. Python favors snake_case for variables and functions, JavaScript and Java use camelCase, and most languages use PascalCase for class names.

Constants are often written in CONSTANT_CASE regardless of language, and kebab-case is effectively the standard for URL paths and CSS classes.

Consistency matters more than the rule

No single format is absolutely correct. What matters most is consistently following the rule your project or team has agreed on.

When joining an existing codebase, favor its conventions over personal taste. If you need to rename many identifiers at once, a case converter helps.