Naming Conventions in Programming: A Quick Guide to Cases

Leader posted 1 min read

When writing code, how you name variables, functions, classes, and files matters more than you might think. Consistent naming conventions improve readability, maintainability, and collaboration. Different programming languages often favor specific “cases” (styles of writing identifiers). Here’s a quick guide to the most common ones and where they’re used.


1. camelCase

Example: myVariableName
Usage: Widely used for variables and functions.

Common in:

  • JavaScript
  • Java
  • C#

2. PascalCase (Upper Camel Case)

Example: MyClassName
Usage: Typically used for class names, constructors, or components.

Common in:

  • C#
  • Java
  • TypeScript

3. snake_case

Example: my_variable_name
Usage: Popular for variables and functions in languages that prefer readability.

Common in:

  • Python
  • Ruby
  • C (sometimes)

4. kebab-case

Example: my-variable-name
Usage: Mostly used in file names, URLs, and CSS classes.

Common in:

  • HTML & CSS
  • Web URLs
  • Some frontend frameworks

5. UPPER_SNAKE_CASE (Screaming Snake Case)

Example: MAX_BUFFER_SIZE
Usage: Used for constants that should not change.

Common in:

  • C
  • C++
  • Java
  • Python

6. Hungarian Notation (Less Common Today)

Example: strName, iCount
Usage: Prefixes indicate variable type.

Common in:

  • Older C and C++ codebases
  • Legacy C# projects

Final Thoughts

There’s no single “best” naming convention, it depends on the language and community standards. The key is consistency. Stick to the conventions of the language you’re using, and your code will be much easier for others (and your future self) to understand.

More Posts

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelskiverified - Mar 19

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelskiverified - Apr 23

Your Tech Stack Isn’t Your Ceiling. Your Story Is

Karol Modelskiverified - Apr 9

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

Tuesday Coding Tip 02 - Template with type-specific API

Jakub Neruda - Mar 10
chevron_left

Related Jobs

View all jobs →

Commenters (This Week)

12 comments
2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!