Keep Variable and Identifier Names Short and Consistent
Categories:
- by default. Avoid
uppercase, _, and camelCase unless a tool or ecosystem requires them.Problem
Naming conventions help keep code and repositories readable, but overly long or
inconsistent names create noise. Mixed styles such as myVariable,
my_variable, and my-variable also make projects harder to scan.
Context
In software development we name files, projects, branches, variables, and other identifiers constantly. A simple default keeps naming predictable and reduces friction.
Solution
Prefer short names that stay clear. Use lowercase with - as the default word
separator. Avoid uppercase, _, and camelCase unless a language, tool, or
upstream convention requires a different format.
This approach has the following benefits:
- Names are easy to read and remember.
- Less typing and less complex typing reduce the chance of mistakes.
- The default is easy to remember: when in doubt, choose the shortest clear name.
Examples and Implementation
Examples of names that follow this convention:
index.htmlstyle.cssmain.js
Project names:
my-projectweb-appe-commerce
Branch names:
feature/add-new-featurefix/bug-123hotfix/security-issue
Use a different format only when the surrounding tool or language expects it, for example when environment variables must be uppercase or a programming language uses snake_case or camelCase for identifiers.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.