Naming Variables: When to use camelCase vs snake_case vs PascalCase?

There are quite a few casing systems out there. Camel case, snake case pascal case, kebab case and etc. Let’s explore their use case scenarios!

Photo by Sebastian Laube on Unsplash

Developers love to use conventions! They help us to organise our code and improve maintainability.

When it comes to naming variables and data structure in our code we use casing conventions to differentiate variable types and symbols.

The followings are the common usage for each casing convention.

Camel Case 🐫

Snake Case 🐍

Pascal Case

Kebab Case 🍖

Upper Snake

Camel Case vs Snake Case

Why?

  1. It is ugly.
  2. The way we write our variable names has special meaning behind it.

For example, if we are working on a financial app, we could have 2 variables called payment_type and payment_gateway .

If we name them as payment_type and paymentGateway , a fellow developer may think that both variables have different structural types or one of them could be a special variable.

Web Development. https://acadea.io/learn . Follow me on Youtube: https://www.youtube.com/c/acadeaio

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store