+ 28

What is Pascal Case, Camel Case and Snake Case?

What is Pascal Case ,Camel Case and Snake Case? Where can I Use it?

9th Feb 2019, 4:25 AM
Khalid Saifullah Fuad
Khalid Saifullah Fuad - avatar
9 Respuestas
+ 19
Paul OMG... These should become the official definitions for casing styles in coding conventions. He said, "because dinos are cool, especially dinos with spikes on their bodies." 🤣😂
9th Feb 2019, 5:16 AM
David Carroll
David Carroll - avatar
+ 15
These are all methods for naming variables. Say I wanted to make a variable for my date of birth. In Pascal Case the name of the variable would be "DateOfBirth" (all words in the name have their first letter capitalized) In Camel Case the name of the variable would be "dateOfBirth" (all words in the name have their first letter capitalized expect the first one) In Snake Case the name of the variable would be "date_of_birth" (the words in the name all contain only lowercase letters and the words are connect by an underscore) Generally Pascal Case is used for naming classes (and some people use them to name constants as well) Camel Case and Snake Case are generally used for the same things so you can just pick whichever one you prefer. They are used for naming variables, properties, functions/methods, etc. (really everything that Pascal Case isn't used for)
9th Feb 2019, 5:10 AM
LynTon
LynTon - avatar
+ 9
Its seems like we forget to mention two more naming conventions. First comes from Microsoft WinAPI, where prefix __ is added like so __foo. Another one which is used in Android SDK (AOSP) where 'm' used for non public fields and 's' for static fields.
13th Feb 2019, 2:31 PM
Lev Tolstoy SPB
Lev Tolstoy SPB - avatar
+ 9
Lev Tolstoy SPB I typically consider prefixes used in naming conventions to be specific to a framework, a language, a platform, a standard, a particular organization / group, and so on and so forth. This discussion seems to be focused on the different types of casing styles used in any given naming convention. For that reason, I'm assuming other naming conventions, like prefixes, were not considered based on context.
13th Feb 2019, 5:57 PM
David Carroll
David Carroll - avatar
+ 8
These are naming conventions for variable names. Remember these are convention not rule. The difference between a rule and a convention is that if you don't follow a rule, your program will cause an error and if you don't follow convention, your program would still run but a convention should be followed to maintain the standard of coding. CamelCase Snake_case
11th Feb 2019, 3:10 AM
Ayush Sinha
Ayush Sinha - avatar
+ 7
David Carroll, You right for sure. But maybe somebody will find it interesting too.
13th Feb 2019, 6:23 PM
Lev Tolstoy SPB
Lev Tolstoy SPB - avatar
+ 5
hssss_hssss 😂😂
9th Feb 2019, 11:01 AM
Sahil Soma
Sahil Soma - avatar
+ 5
Personally, I like dromedaries for variables, camels for functions... and kebabs for dinner. lol
9th Feb 2019, 7:47 PM
Mark
+ 1
@chillPill LOL🤣🤣🤣🤣 ( I just switched to Gboard for ROFLs) Made my day…
4th Apr 2019, 2:00 PM
Emoji FanBoy
Emoji FanBoy - avatar