Four Case Styles you should know!

In programming, we are mostly not allowed to use space characters between words because it is interpreted as the end of identifier or beginning of something new.
Instead, we use certain naming conventions in order to use multiple words for naming varia…


This content originally appeared on DEV Community and was authored by SYED MAZHAR ALI RAZA

In programming, we are mostly not allowed to use space characters between words because it is interpreted as the end of identifier or beginning of something new.
Instead, we use certain naming conventions in order to use multiple words for naming variables, classes, functions, etc. in the source code.
Following are the most popular case styles used in programming:

  1. Camel case
  2. Pascal case
  3. Snake case
  4. Kebab case

Camel Casing:

camelCase
For using the camel case style, the rule is to remove spaces and capitalize each word, except the first one.
Eg: first name will be written as firstName in this case style.
Application: The camel case style is used as the naming convention of variables and functions in various programming languages like JavaScript.

Pascal Casing:

PascalCase
For using the pascal case style, the rule is to remove spaces and capitalize each word, including the first one.
Eg: first name will be written as FirstName in this case style.
Application: In Java, all classes, interfaces and enums are expected to use Pascal case. C# uses PascalCase for namespaces and even public methods.

Kebab Casing:

kebab-case
The craving makes it difficult to write but by gathering all my self-control, here I go. The rule for kebab casing is to remove spaces and then add a hyphen "-" between each word.
Eg: first name will be written as first-name in this case style.
Application: In CSS, property names are written in this style. This style is also often used in URLs.

Snake Casing:

snake_case
For using the snake case style, the rule is to remove spaces and add an underscore "_" to separate each word.
Eg: first name will be written as first_name in this case style.
Application: It is used conventionally in declaring database field names. Python uses the style for variable names, function names, method names, and module or package (i.e. file) names. PHP uses SCREAMING_SNAKE_CASE for class constants.


This content originally appeared on DEV Community and was authored by SYED MAZHAR ALI RAZA


Print Share Comment Cite Upload Translate Updates
APA

SYED MAZHAR ALI RAZA | Sciencx (2021-09-07T07:45:55+00:00) Four Case Styles you should know!. Retrieved from https://www.scien.cx/2021/09/07/four-case-styles-you-should-know/

MLA
" » Four Case Styles you should know!." SYED MAZHAR ALI RAZA | Sciencx - Tuesday September 7, 2021, https://www.scien.cx/2021/09/07/four-case-styles-you-should-know/
HARVARD
SYED MAZHAR ALI RAZA | Sciencx Tuesday September 7, 2021 » Four Case Styles you should know!., viewed ,<https://www.scien.cx/2021/09/07/four-case-styles-you-should-know/>
VANCOUVER
SYED MAZHAR ALI RAZA | Sciencx - » Four Case Styles you should know!. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/09/07/four-case-styles-you-should-know/
CHICAGO
" » Four Case Styles you should know!." SYED MAZHAR ALI RAZA | Sciencx - Accessed . https://www.scien.cx/2021/09/07/four-case-styles-you-should-know/
IEEE
" » Four Case Styles you should know!." SYED MAZHAR ALI RAZA | Sciencx [Online]. Available: https://www.scien.cx/2021/09/07/four-case-styles-you-should-know/. [Accessed: ]
rf:citation
» Four Case Styles you should know! | SYED MAZHAR ALI RAZA | Sciencx | https://www.scien.cx/2021/09/07/four-case-styles-you-should-know/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.