Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 

Repository files navigation

Variable Naming Conventions (Casing)

πŸ“Œ Note

There is no single "best" casing for all programming languages. Always follow the naming convention recommended by the language, framework, or project style guide.

Language/Technology Preferred Variable Case
Python snake_case
JavaScript camelCase
Java camelCase
Go camelCase / PascalCase
C# camelCase / PascalCase
Kubernetes JSON/YAML Fields camelCase
Environment Variables SCREAMING_SNAKE_CASE
CSS Classes kebab-case

1. lowercase

All characters are lowercase with no separators.

numberofdonuts
favephrase
podip

Common Uses

  • Simple identifiers
  • File names
  • URLs

2. UPPERCASE

All characters are uppercase.

NUMBEROFDONUTS
FAVEPHRASE
PODIP

Common Uses

  • Constants
  • Macros
  • Legacy code

3. snake_case

Each word is separated by an underscore (_), and all letters are lowercase.

number_of_donuts = 34
fave_phrase = "Hello World"
pod_ip = "10.244.0.5"

Common Uses

  • Python
  • Databases
  • Linux commands
  • Configuration files

4. SCREAMING_SNAKE_CASE

Each word is separated by an underscore (_), and all letters are uppercase.

MAX_RETRIES
DATABASE_URL
API_KEY
POD_IP

Common Uses

  • Constants
  • Environment variables
  • Configuration values

5. kebab-case

Each word is separated by a hyphen (-).

number-of-donuts
fave-phrase
pod-ip

Common Uses

  • URLs
  • CSS class names
  • HTML IDs
  • Kubernetes resource names

Example:

metadata:
  name: nginx-webserver

6. camelCase (Lower Camel Case)

The first word starts with a lowercase letter. Each subsequent word begins with an uppercase letter.

numberOfDonuts = 34;
favePhrase = "Hello World";
startTime = new Date();
podIP = "10.244.0.5";

Common Uses

  • JavaScript
  • Java
  • Go (unexported identifiers)
  • Kubernetes API fields

Example (Kubernetes):

status:
  podIP: 10.244.0.5
  hostIP: 192.168.1.10
  startTime: "2026-07-11T10:00:00Z"

7. PascalCase (Upper Camel Case)

Similar to camelCase, but the first word also starts with an uppercase letter.

NumberOfDonuts
FavePhrase
PodInfo
StartTime

Common Uses

  • Class names
  • Struct names
  • Interfaces
  • Go exported identifiers
  • C#

8. Train-Case

Each word starts with a capital letter and is separated by a hyphen (-).

Number-Of-Donuts
Fave-Phrase
Pod-IP

Common Uses

  • Document titles
  • Some configuration formats

9. dot.case

Words are separated by periods (.).

app.name
user.email
pod.ip

Common Uses

  • Configuration keys
  • Package names
  • Properties files

10. Title Case

Each word starts with a capital letter and words are separated by spaces.

Number Of Donuts
Fave Phrase
Pod IP

Common Uses

  • Headings
  • Documentation
  • UI labels

Acronyms in Naming Conventions

Many APIs preserve acronyms in uppercase.

Examples:

podIP
hostIP
clusterIP
userID
apiURL

Some projects instead use:

podIp
hostIp
userId
apiUrl

Kubernetes follows the first style, so the correct field names are:

status:
  podIP: 10.244.0.5
  hostIP: 192.168.1.10

Example:

kubectl get pod nginx \
-o jsonpath='{.status.podIP}'

Summary

Case Example Common Uses
lowercase podip File names, simple identifiers
UPPERCASE PODIP Constants
snake_case pod_ip Python, databases
SCREAMING_SNAKE_CASE POD_IP Environment variables
kebab-case pod-ip URLs, CSS, Kubernetes resource names
camelCase podIP JavaScript, Java, Kubernetes API
PascalCase PodIP Classes, Go exported types, C#
Train-Case Pod-IP Titles
dot.case pod.ip Configuration keys
Title Case Pod IP Documentation headings

πŸ’Ό Connect with me πŸ‘‡πŸ‘‡ 😊

About

πŸ“š A practical reference for variable naming conventions and casing styles across Python, JavaScript, Java, Go, C#, Kubernetes, Linux, CSS, URLs, and configuration files.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors