If you are new to programming and on the spree of exploring the languages one thing you must have observed as a common factor in all programming languages is that they do not use spaces. They use the casings to separate the words in the language.
Of the various types used 3 of the followings are very commonly used conventions for casing
Let say the word we are trying to write is onetwothreefour. If you see you will find that reading the word is not easy on eyes as well as for identification. Hence lets see how can we use the above listed word using cases
-
camelCasing
In camel casing , First Letter of the word is written in UPPER CASE except for the first letter of first word.
So the word written on top will become like this
oneTwoThreeFour
-
PascalCasing
Pascal Casing is similar to camelCasing with only difference that in Pascal Casing First Letter of First Word is also written in UPPER CASE.
OneTwoThreeFour
- Snake_Casing
Snake Casing Majorly used in Python, it doesn't require to change the cases of the words , instead it will require you to add underscore ( _ ) between the words.
one_two_three_four
Now various programming languages used this in different combinations. I have listed the following for Java, Python and JavaScript
Language |
For naming class,interface |
For naming variables and methods |
Java |
PascalCasing |
camelCasing |
JavaScript |
PascalCasing |
camelCasing |
Python |
PascalCasing |
snake_casing |