All about cases: Camel, Snake, Kebab & Pascal

YASH RAJ
1 min readJun 29, 2020

--

In programming, you would come across these when naming a variable, class, or function. Keeping your case types and styles consistent allows your code to be more readable and makes collaboration easier.

So what’s the difference and when should you use them?

🐪 camelCase

I’d say this is the most popular case type and mostly used for variable names and functions in many languages.

const anExampleVar = true;

bool anExampleVar = true;

function anExampleFunction () {...}

🦎 PascalCase

Very similar to camelCase apart from the first letter is capitalized. This is the style most commonly used for declaring classes in many programming languages.

class MyExampleClass { …. }

public class MyExampleClass { …. }

new MyExampleClass (...)

🥙 kabab-case

You would see this style most commonly used in HTML and CSS when naming classes and IDs when naming files such as images and also quite often in URLs

my-image-file.jpg

www.website.com/a-page-title

class=”css-class-name”

🐍 snake_case

I think this is most commonly used in PHP, Ruby and Python for variables and functions names. It would also be found in database naming conventions.

$example_var = "hello"

def my_function():

The uppercase version of this (SNAKE_CASE) is often used when declaring constants in PHP.

define("EXAMPLE_VAR", true)

So these are the cases which we generally use.

--

--

YASH RAJ
0 Followers

I write about tech, business strategies, insights on my personal blog. https://intotheinsights.com/articles