DEV Community

Cover image for CASE STYLES IN PROGRAMMING !
ABHINAVA GHOSH (he/him)
ABHINAVA GHOSH (he/him)

Posted on

CASE STYLES IN PROGRAMMING !

have you ever came across words like camel case ,snake case and wondered what actually they mean? 😕

In this Article I will be elaborating about the different case styles available in computer programming.

The most popular ways to combine words into a single string:


  • 🐫 camelCase: Camel case combines words by capitalizing all words following the first word and removing the space, as follows:

Raw:

the unconventional coder

Camel Case:

theUnconventionalCoder
----👆--------------👆

Use: Mainly in variable declaration.


  • Pascal Case : Pascal case combines words by capitalizing all words (even the first word) and removing the space, as follows:

Raw:

the unconventional coder

Pascal Case:

TheUnconventionalCoder

Use: Declaring classes


  • 🐍 Snake Case : Snake case combines words by replacing each space with an underscore (_) and, in the all caps version, all letters are capitalized, as follows:

Raw:

the unconventional coder

Snake Case:

the_unconventional_coder

Use : Used for naming constants.


  • Kebab Case : Kebab case combines words by replacing each space with a dash (-), as follows:

Raw:

the unconventional coder

Kebab Case:

the-unconventional-coder

Use : Used for naming URL's.


reference

Please leave a ❤️ if you liked this article!
And feel free to leave any suggestions for me in the discussions panel.

Top comments (3)

Collapse
 
mustabelmo profile image
Mustapha Belmokhtar • Edited

Note the kebab is a meal of meat especially cut into small pieces and joined by a tiny stick of wood or metal.
That's why that way of joining strings is called so, the hyphen stands for the empty space between the pieces of meat.

Collapse
 
the_unconventional_coder profile image
ABHINAVA GHOSH (he/him)

very practical example i must agree!

Collapse
 
moaxcp profile image
John Mercier

I just recently had to deal with this when generating classes for x11-client. The guava library has a class called CaseFormat which can perform conversions between the different formats programatically.

I used it here.