Complete Guide to Naming Conventions and Case Styles
Why naming conventions matter
Naming conventions are enforced (or expected) by language communities, linters, and style guides. Using the wrong convention does not break code — but it makes it look foreign to native speakers of that language. Python expects snake_case for functions; JavaScript expects camelCase; CSS expects kebab-case. In a codebase that mixes conventions without reason, readers spend cognitive energy decoding intent instead of understanding logic. Most style guides are authoritative: PEP 8 for Python, Google Java Style Guide, and Airbnb JavaScript Style Guide all specify case conventions explicitly.
Programming case conventions by language
JavaScript/TypeScript: camelCase for variables and functions, PascalCase for classes and components, SCREAMING_SNAKE_CASE for constants. Python: snake_case for everything (PEP 8), SCREAMING_SNAKE_CASE for module-level constants, PascalCase for classes. Java: camelCase for methods and variables, PascalCase for classes, SCREAMING_SNAKE_CASE for constants. Go: camelCase for unexported names, PascalCase for exported names. Rust: snake_case for functions and variables, PascalCase for types and enums, SCREAMING_SNAKE_CASE for constants. CSS: kebab-case for all class names and custom properties.
URL slugs and SEO
URLs use kebab-case by convention: /blog/my-post-title not /blog/my_post_title or /blog/myPostTitle. Google recommends hyphens over underscores in URLs — Google treats hyphens as word separators but historically treated underscores as part of a word. Lowercase is required: URLs are case-sensitive on most servers. A good slug is short, descriptive, and uses real words rather than abbreviations. This tool's kebab-case output is a good starting point for URL slugs.
Environment variables and configuration
Environment variables used in .env files, Docker, Kubernetes, and CI/CD universally use SCREAMING_SNAKE_CASE: DATABASE_URL, API_KEY, NODE_ENV. This convention comes from Unix shell, where variable names are case-sensitive and uppercase names are used for environment and shell variables. Configuration libraries like Spring Boot use a relaxed binding that accepts kebab-case, snake_case, or camelCase as aliases for the same property — but the canonical form in application.properties uses dot.case (spring.datasource.url).
Database column naming
SQL is case-insensitive for identifiers in most databases, but convention matters for readability. PostgreSQL: unquoted identifiers are lowercased internally; snake_case is the idiomatic convention (user_id, created_at). MySQL: similar, snake_case is standard. SQL Server: traditionally uses PascalCase or camelCase. ORM frameworks (Django, SQLAlchemy, ActiveRecord) typically use snake_case for database columns and convert automatically to camelCase for the application model. Always be consistent within a project — mixed naming in schema columns causes confusion when writing queries.
Handling acronyms in naming conventions
Acronyms like URL, HTTP, XML, and ID create ambiguity in case conversions. Two schools of thought exist. Google/Go style: treat the acronym as a regular word — URL becomes Url in PascalCase (getUrl instead of getURL). This makes string operations predictable. Microsoft/.NET style: keep acronyms uppercase — URL stays URL in PascalCase (GetURL). Two-letter acronyms (ID, OK) are usually all-caps. This tool splits consecutive uppercase runs at the transition back to lowercase — XMLParser becomes xmlParser in camelCase.
Case conversion in code
Most languages have utilities for case conversion. JavaScript: no built-in, but lodash provides _.camelCase(), _.snakeCase(), _.kebabCase(). Python: str.lower(), str.upper(), and re.sub() for structural cases; the humps and inflect libraries provide full conversion. Ruby: ActiveSupport provides underscore, camelize, dasherize, and classify. Go: strings package handles basic transforms; golang.org/x/text/cases provides Unicode-aware title casing. For structural cases like camelCase and snake_case, manual implementation or a dedicated library is required in most languages.