Skip to content
Patppuccin
Main Navigation
Expeditions
Curations
Ruminations
Labs
Projects
Persona

Appearance

Sidebar Navigation

Faith & Theology

Genesis Chapter 1

Science & Nature

Health & Medicine

People & Culture

Languages & Comms

Philosophy

History

Economics

Art & Literature

Tech & Engineering

History of Computing

Fundamentals of Computing

Systems & Architecture

The Linux OS

Hardware & Embedded Systems

Networking & Internet

Computer Networking

Programming & Paradigms

Bash

Concepts

Authentication and Authorization

Infrastructure as Code (IaC)

Free and Open Source (FOSS)

Variable Naming Cases

Version Control Systems

Golang

JavaScript

PowerShell

PowerShell Error Handling

PowerShell Flow Control and Loops

PowerShell Functions

PowerShell Modules

PowerShell Basics

Python

Data Types and Variables

Flow Control and Loops

Fundamentals

Getting Started

Methods and Functions

Operators

Python

Rust Programming Language

Software Engineering

Application Development

Infrastructure & Cloud

Amazon Web Services

Amazon Web Services

Cloud Technology

DevOps & Automation

Kubernetes

Terraform

Security Engineering

Data Systems

Computational Intelligence

Design & Interaction

Tooling & Utilities

Git

Secure Shell (SSH)

On this page

Variable Naming Cases in Programming ​

Naming conventions are essential in programming to ensure code is clean, readable, and consistent. By using specific naming styles for variables, functions, classes, and constants, developers create code that is easier to understand and maintain.

This guide highlights the most commonly used naming cases, their formats, and their applications in different programming languages. From the widely adopted camel case in JavaScript to snake case in Python and Pascal case for class names, each naming style serves a specific purpose.

The table below provides a concise overview of these naming conventions, followed by detailed examples.

CaseFormatLanguagesExample
Camel CaselowerCamelCaseJavaScript, Java, Go, SwiftuserName, calculateTotal
Snake Caselower_snake_casePython, Ruby, SQLuser_name, calculate_total
Pascal CaseUpperCamelCaseC#, Java, Go, SwiftUserName, CalculateTotal
Upper Snake CaseUPPER_SNAKE_CASEPython, Java, C, RubyMAX_LIMIT, DEFAULT_TIMEOUT
Kebab Caselower-kebab-caseCSS, HTML, JavaScriptuser-profile, data-entry
Dot Caselower.case.with.dotsJSON, YAML, Config filesuser.name, file.version

Camel Case ​

  • Format: lowerCamelCase
  • Description: The first word is lowercase, and subsequent words are capitalized. Widely used for variables, functions, and method names.
  • Languages: JavaScript, Java, TypeScript, Go (private variables/methods), Swift.
  • Example:
javascript
let userName = "JohnDoe";
function calculateTotal(price, tax) {
    return price + tax;
}

Snake Case ​

  • Format: lower_snake_case
  • Description: All words are lowercase and separated by underscores. Common in Python and databases for readability.
  • Languages: Python, Ruby, SQL, C.
  • Example:
python
user_name = "JohnDoe"
def calculate_total(price, tax):
    return price + tax

Pascal Case ​

  • Format: UpperCamelCase
  • Description: Similar to camel case, but the first letter of every word is capitalized. Frequently used for class names, enums, and constructor functions.
  • Languages: C#, Java, Go (exported variables/functions), Swift.
  • Example:
java
public class UserAccount {
    private String UserName;

    public UserAccount(String userName) {
        this.UserName = userName;
    }
}

Upper Snake Case ​

  • Format: UPPER_SNAKE_CASE
  • Description: All words are uppercase, separated by underscores. Standard for defining constants.
  • Languages: Python, Java, C, Ruby.
  • Example:
python
MAX_LIMIT = 1000
DEFAULT_TIMEOUT = 30

Kebab Case ​

  • Format: lower-kebab-case
  • Description: Words are lowercase and separated by hyphens. Popular in CSS class names and URLs.
  • Languages: CSS, HTML, JavaScript (for file names or configs).
  • Example:
css
.user-profile {
    font-size: 16px;
    color: #333;
}

Dot Case ​

  • Format: lower.case.with.dots
  • Description: Words are lowercase and separated by dots. Primarily used in configurations or keys in data formats.
  • Languages: JSON, YAML, Configurations.
  • Example:
json
{
  "user.name": "JohnDoe",
  "user.age": 25
}

Updated at:

Pager
Previous pageFree and Open Source (FOSS)
Next pageVersion Control Systems

Made with ❤️ and Vitepress

Copyright © 2025 Patrick Ambrose.