What are the differences between some of the popular casing styles in programming?

A quick explanation of popular casing styles.

What are the differences between some of the popular casing styles in programming?
Photo by Chris Ried / Unsplash
💡
This is part of an on-going series in coding foundations. Check the coding 101 article tag index from time to time for more content.

Happy Sunday! Today's article is very brief. I just wanted to describe the differences between popular casing styles in coding. It's good to know and helps writing/reading code make a little more sense in the native language that recommends it.

  • Snake Case
    • This style features all words in lowercase but with underscores for space separation.
    • Example: my_cool_variable
    • Languages whose style guides recommend it for variables: Python, Ruby, Rust
  • Camel Case
    • This style features all words together (no space) but each word has a capital first letter... except the first word.
    • Example: myCoolVariable
    • Languages whose style guides recommend it for variables: Java, JavaScript
  • Pascal Case
    • This style features all words together (no space) but every word (including the first word) has a capital first letter.
    • Example: MyCoolVariable
    • Languages whose style guides recommend it for variables: C#

Different languages have preferences but may be compatible with other formats. For example, even though Python's style guide (PEP8) strongly recommends snake case, the language will technically still work with camel case and pascal case.

For more information, please check these resources:

What are the different kinds of cases?
I’m interested in the different kinds of identifier cases, and what people call them. Do you know of any additions to this list, or other alternative names? myIdentifier : Camel case (e.g. in java
Quick Guide to Programming Case Types
A look at common case types (e.g. camel case, kebab case) used during development.
Capitalization Conventions - Framework Design Guidelines
Apply capitalization conventions for identifiers, compound words, and common terms. Understand how case sensitivity works in .NET.