~/ Types of Naming Conventions in Programming

A practical guide to naming conventions like camelCase, PascalCase, snake_case, and others - with examples and when to use them.

June 9, 2025

|

3 min read

Naming Conventions
Best Practices
Code Style
Programming

Writing clean, consistent code isn't just about logic-naming plays a big part. Whether you're working solo or on a team, using clear naming conventions makes your code easier to read, maintain, and scale.

Below are the most widely used naming conventions across programming languages, with code examples and when to use each.

In camelCase, the first word is lowercase, and each subsequent word starts with a capital letter. This is commonly used for variables, functions, and object properties in JavaScript and many other languages.

JavaScript

let userName = "johndoe"; function getUserProfile() { // ... }

PascalCase is similar to camelCase, except the first word also starts with a capital letter. It's often used for classes and constructors.

TypeScript

class UserProfile { constructor(public userName: string) {} }

snake_case uses all lowercase letters with underscores between words. It's the convention of choice in Python for function names, variable names, and sometimes file names.

Python

def get_user_profile(): pass user_name = "johndoe"

kebab-case uses lowercase words separated by hyphens. Since hyphens aren't allowed in variable names in most languages, it's primarily used for CSS classes, file names, and URLs.

Plain Text

user-profile-card main-header-style

This style uses all uppercase letters with underscores, and it's commonly used for constants and configuration keys.

JavaScript

const MAX_LOGIN_ATTEMPTS = 5; const API_ENDPOINT = "https://api.example.com";

Here's a quick reference comparing each naming convention and when to use it:

ConventionExampleUsed For
camelCasegetUserNameVariables, functions, object keys
PascalCaseUserProfileClasses, constructors, components
snake_caseget_user_profilePython code, file names, DB fields
kebab-casemain-headerCSS classes, URLs, filenames
SCREAMING_SNAKE_CASEMAX_RETRIESConstants, env variables

While there's no one-size-fits-all rule, sticking to the standard naming conventions of your language or framework helps reduce confusion and makes collaboration smoother. The goal is clarity-pick a convention that's readable and consistent, and your future self (and teammates) will thank you.