SC.
Developer Guide

Programming Naming Conventions Explained: camelCase, PascalCase, snake_case, & More

By Shahid Adnan WaliPublished: 2026-07-17Updated: 2026-10-196 Min Read

In software engineering, code is read far more often than it is written. Variable, function, and class identifiers serve as the primary vocabulary of any codebase. When naming is inconsistent, reading code requires constant mental context-switching, increasing cognitive fatigue and introducing bugs.

Because computer compilers treat whitespace as a delimiter separating lexical tokens, developers cannot simply type multi-word phrases separated by spaces. To represent concepts clearly without breaking compiler grammar, the industry developed standardized casing systems.

Whether you are converting legacy database columns or formatting API payloads, you can transform strings instantly between these formats using our browser-based case converter.

The Core Naming Conventions

The modern programming landscape relies on five primary naming conventions:

1. camelCase (lowerCamelCase)

In camelCase, words are joined without spaces. The first word is completely lowercase, and the first letter of every subsequent word is capitalized:

  • Pattern: wordOneWordTwoWordThree
  • Typical Use Cases: Variable names, function definitions, object properties, and class methods in JavaScript, TypeScript, Java, and C#.
// TypeScript Example
const userAccountBalance: number = 1050.75;

function calculateDiscountRate(customerScore: number): number {
  return customerScore > 100 ? 0.15 : 0.05;
}

2. PascalCase (UpperCamelCase)

PascalCase follows the same capitalization pattern as camelCase, with one crucial distinction: the very first letter of the first word is also capitalized:

  • Pattern: WordOneWordTwoWordThree
  • Typical Use Cases: Classes, interfaces, types, enums, and React/Vue UI components.
// TypeScript Example
interface UserProfileData {
  userId: string;
  emailAddress: string;
}

class PaymentProcessingGateway {
  public processTransaction(profile: UserProfileData): boolean {
    return true;
  }
}

3. snake_case

In snake_case, all letters are written in lowercase, and individual words are separated by an underscore (_):

  • Pattern: word_one_word_two_word_three
  • Typical Use Cases: Function and variable names in Python, Ruby, PHP, Rust, and standard SQL database tables and column identifiers.
# Python Example
def calculate_shipping_cost(package_weight_kg, destination_zone):
    base_rate = 5.0
    return base_rate + (package_weight_kg * 1.25)

4. SCREAMING_SNAKE_CASE (UPPER_SNAKE_CASE)

Also known as constant case, this variation writes every letter in uppercase with words separated by underscores:

  • Pattern: WORD_ONE_WORD_TWO_WORD_THREE
  • Typical Use Cases: Global constants, configuration parameters, environment variables, and immutable values across virtually all languages.
# Global Constants
MAX_CONNECTION_RETRIES = 5
DEFAULT_CACHE_EXPIRATION_SECONDS = 3600
API_BASE_URL = "https://api.example.com/v1"

5. kebab-case (spinal-case)

In kebab-case, all letters are lowercase, and individual words are separated by a hyphen (-):

  • Pattern: word-one-word-two-word-three
  • Typical Use Cases: CSS classes, HTML data attributes, URL slugs, package names in npm, and configuration files (like Kubernetes YAML manifests).
/* CSS Example */
.main-navigation-menu {
  display: flex;
  background-color: var(--brand-primary-dark);
}

Why kebab-case fails as a code identifier: In JavaScript, Python, C++, and most general-purpose languages, the hyphen (-) is the arithmetic subtraction operator. Typing let total-cost = 10; will cause a syntax error because the engine parses the line as total minus cost.

A Historical Note on Hungarian Notation

In the 1980s and 1990s, Hungarian notation (introduced by Microsoft Chief Architect Charles Simonyi) was widely adopted across Windows C and C++ programming.

Hungarian notation added a short lowercase prefix to variable names to communicate their underlying data type or scope:

  • szName (zero-terminated string)
  • iCounter (integer)
  • dwTotalBytes (double word / 32-bit unsigned integer)
  • m_pSocket (member variable pointing to a socket)

While Hungarian notation solved a real challenge in early dynamically typed or loosely typed environments lacking IDE tooling, it fell out of favor. In modern languages with rich type inference, static analyzers, and autocomplete, prefixing variables adds visual clutter and creates maintenance hazards when variable types are refactored.

Industry Language Standards

Different software communities follow well-documented, formal style guides. Deviating from these conventions makes code feel unidiomatic to collaborating engineers.

| Language | Variables & Functions | Classes & Types | Constants | File & Directory Names | | :--- | :--- | :--- | :--- | :--- | | JavaScript / TypeScript | camelCase | PascalCase | SCREAMING_SNAKE_CASE | kebab-case or camelCase | | Python (PEP 8) | snake_case | PascalCase | SCREAMING_SNAKE_CASE | snake_case.py | | Go | camelCase (unexported) / PascalCase (exported) | PascalCase | camelCase or PascalCase | snake_case.go | | Rust | snake_case | PascalCase | SCREAMING_SNAKE_CASE | snake_case.rs | | Java & C# | camelCase (vars/methods in Java) / PascalCase (methods in C#) | PascalCase | SCREAMING_SNAKE_CASE | PascalCase.java / PascalCase.cs | | SQL & Databases | snake_case | snake_case (tables) | UPPERCASE (keywords) | snake_case.sql |

Python: The Strict PEP 8 Standard

Python's official style guide, PEP 8, outlines precise rules:

  • Functions and Variables: Always snake_case (fetch_user_record).
  • Classes: Always PascalCase (UserProfileManager).
  • Protected/Internal Members: Single leading underscore (_internal_helper).
  • Private / Name Mangling: Double leading underscore (__private_field).
  • Special Dunder Methods: Double leading and trailing underscores (__init__, __str__).

Go: Case Determines Visibility

In the Go programming language, letter casing is not merely a stylistic preference; it is a fundamental language feature that governs access control:

  • An identifier beginning with a capital letter (e.g., func ParseJSON()) is exported and accessible outside the package.
  • An identifier beginning with a lowercase letter (e.g., func parseJSON()) is unexported and visible only within its package.
  • Acronyms in Go remain capitalized: idiomatic Go uses ServeHTTP, userURL, and nodeID, rather than ServeHttp, userUrl, or nodeId.

SQL & Database Normalization

While SQL keywords (like SELECT, WHERE, JOIN) are conventionally written in uppercase for clarity, table and column names should consistently use snake_case.

Different relational database engines handle casing unpredictably:

  • PostgreSQL converts unquoted identifiers to lowercase automatically.
  • MySQL on Windows is case-insensitive, but MySQL on Linux matches table names against the underlying case-sensitive file system.
  • Standardizing database identifiers on lowercase snake_case avoids cross-platform query failures.

Practical Code Hygiene and Automated Tooling

Modern engineering teams do not rely on manual review to enforce naming conventions. Instead, automated linters and code formatters handle enforcement:

  • ESLint (with @typescript-eslint/naming-convention) enforces camelCase, PascalCase, and screaming snake case across TypeScript projects.
  • Ruff and Flake8 enforce PEP 8 naming across Python repositories.
  • Clippy catches non-idiomatic naming conventions in Rust projects.

When migrating legacy code, integrating external third-party API payloads, or standardizing database schemas across different languages, using a dedicated case converter allows you to reformat large text blocks without manual editing.

Sources & Further Reading

Frequently Asked Questions

Everything you need to know

01Why can't programming languages use spaces in variable names?▾
Compilers and interpreters use lexical analysis (tokenization) to parse code. Whitespace characters act as delimiters separating distinct keywords, identifiers, and operators. Allowing spaces inside variable names would create syntactic ambiguity.
02What is the difference between camelCase and PascalCase?▾
Both conventions eliminate spaces and capitalize subsequent words. However, camelCase starts with an initial lowercase letter (e.g., 'userSessionId'), while PascalCase capitalizes the very first letter (e.g., 'UserSessionId').
03Why is kebab-case invalid for variables in most programming languages?▾
Most programming languages reserve the hyphen character (-) as the arithmetic subtraction operator. If a language permitted 'total-cost', the parser would evaluate it as the expression 'total minus cost' rather than a single variable name.
04What is Hungarian notation and why did it fall out of favor?▾
Popularized at Microsoft in the 1980s, Hungarian notation prefixed variable names with letters indicating their data type (e.g., 'strName' for a string or 'iCount' for an integer). Modern IDEs with intelligent hover tooltips, type inference, and static type checking made type prefixes redundant and tedious to maintain.
Back to Learn