Camel vs Snake

If you think this is a zoo. That’s not the “case”

Carlos Aldea
3 min readMar 27, 2023
Photo by Jason Leung on Unsplash

Let’s give this a name

When programming, you have to name things. You know. Functions, variables, macros…

And I think that we all agree that it is essential to use a consistent naming convention to make your code readable and understandable to other developers. Two popular naming conventions are camel case and snake case. While they both have their benefits, they differ in their approach to capitalization and underscores.

CAMEL CASE

This naming convention are actually two. As we have the “low camel case” and the “upper camel case”.

Lower camel case is a naming convention that uses capitalization to distinguish between words in a compound phrase. The first word is written in lowercase, and subsequent words are written in uppercase. For example, “firstName” or “totalAmountDue.” The name camel case comes from the way the capitalized words resemble the humps of a camel.

Upper camel case (AKA Pascal Case) differentiates from the first just in the first letter. As it starts with upper case. For example “FirstName” or “TotalAmountDue”.

One of the benefits of camel case is that it can make the code more readable and easier to understand. The use…

--

--

Carlos Aldea

I am an addict. But don't worry, my addiction is a good one. I love learning things. And I am going to try sharing my learnings.