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 |
All characters are lowercase with no separators.
numberofdonuts
favephrase
podip
Common Uses
- Simple identifiers
- File names
- URLs
All characters are uppercase.
NUMBEROFDONUTS
FAVEPHRASE
PODIP
Common Uses
- Constants
- Macros
- Legacy code
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
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
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-webserverThe 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"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#
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
Words are separated by periods (.).
app.name
user.email
pod.ip
Common Uses
- Configuration keys
- Package names
- Properties files
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
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.10Example:
kubectl get pod nginx \
-o jsonpath='{.status.podIP}'| 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 |
- π₯ YouTube: https://www.youtube.com/@DevOpsinAction?sub_confirmation=1
- β Blog: https://ibraransari.blogspot.com/
- πΌ LinkedIn: https://www.linkedin.com/in/ansariibrar/
- π¨βπ» GitHub: https://github.com/meibraransari?tab=repositories
- π¬ Telegram: https://t.me/DevOpsinActionTelegram
- π³ Docker Hub: https://hub.docker.com/u/ibraransaridocker