You may have had these burning questions in your mind:
What are the different naming standards?
What are the most common uses of each naming convention?
What does the naming convention I prefer to say about me?
I didn’t think so either, but here we are. Snek, the snake, will help us answer these questions.
What is a naming convention
You have to name many things as a programmer. These include variables, classes, methods, and functions. Name conventions help to ensure consistency and reliability. This will improve the readability of the code.
List of programming naming conventions
Here are some of the most common (plus a few extras). Let Snek do the talking…
Snake Case
snake_case uses a variable name convention in which each word is lowercase and separated with underscores. This is also called pothole_case.
Examples: last_name, annual_earnings, total_snakes_found.
They are used in: Python and Ruby, C/C++ libraries, WordPress database table names, and column names.
What does your favorite case say about you? You’d be happy to usher in a new age of AI dominance if it helped you segment your sock collection.
Screaming Snake Case
SCREAMING_SNAKE_CASE is a variable naming convention where each word is in upper case and separated by underscores. It is also known as MACRO_CASE or CONSTANT_CASE.
Examples: FIRST_NAME, TOTAL_SCORE, SNAKE_PAIN_THRESHOLD.
They are commonly used in Naming constants in C, Javascript, and Java.
If it’s your favorite case, what it says about you: You’re as unalterable as a rock, hate risky errors, and listen to loud music while VSC is set to “darker than dark” mode.
Lowercase
Lowercase is a variable naming convention where each word is in lowercase, and they are not separated by spaces, dashes, or underscores. It is also known as a flat case.
Examples: middle name, first login date, snakessteppedon.
They were commonly used in: HTML elements and attributes.
If it’s your favorite case, what it says about you: You do things your way! After all, you know what your code means. That’s why you don’t write comments on it.
Uppercase
UPPERCASE is a variable naming convention where each word is in uppercase, not separated by spaces, dashes, or underscores.
Examples: DATEOFBIRTH, STARTINGHP, MAXTWEETSPERMINUTE.
They were commonly used in Naming constants and ex-presidential tweets.
If it’s your favorite case, what it says about you: You need to learn how to turn off your caps lock, probably because you hit your keyboard after your last compilation error.
Camel case
camelCase is a variable naming convention where the first word is always in lowercase and every other word starts with a capital letter. The words are also not separated by spaces, dashes, or underscores. It is also known as dromedaryCase.
Examples: firstName, currentAccountBalance, humpsOnAliceTheCamel.
They were commonly used in Pascal, Modula, .NET, JavaScript, and Java instance and local variable names. JSON element names.
If it’s your favorite case, what it says about you: You own an iPhone, like to shop on eBay, and still remember what your first teacher taught you about naming conventions.
Camel snake case
camel_Snake_Case is a variable naming convention where the first word is always in lowercase and every other word has the first letter capitalized. Underscores also separate the words.
Examples: minutes_Taken, withdrawal_Amount, snakes_Wearing_Blankets.
They were commonly used in Similar use cases to camelCase.
If it’s your favorite case, what it says about you: You fret about giving people the right directions to find your house because you want them to stay aware of your location. People see your love of best practices as both helpful and irritating.
Kebab case
Kebab-case is a variable naming convention where each word is in lowercase and separated by dashes. It is also known as dash-case, list-case, or spinal case.
Examples: first-name, transactions-made, kebabs-eaten-today.
They are commonly used in COBOL, Lisp, Perl 6, CSS class names, HTML ids, Java, and JavaScript REST endpoints.
If it’s your favorite case, what it says about you: You like alternative music over mainstream music, you probably work with websites, and now you’re hungry. Thanks article.
Screaming kebab case
SCREAMING-KEBAB-CASE is a variable naming convention where each word is in uppercase and separated by dashes. It is also known as MACRO_CASE or CONSTANT_CASE.
Examples: LAST-NAME, TOTAL-PAID, KEBAB-TWEETS-MADE.
They are commonly used in: Macros.
If it’s your favorite case, what it says about you: You love reusing things, like copy-pasting the same message to people in personal messages. IYou will ifyou can wear your socks two days in a row because it’s the weekend,
Spongebob case
spOngeBoB_Case is a variable naming convention where the text alternates from upper to lowercase to indicate sarcasm, based on the popular “Mocking SpongeBob” meme. It may or may not include spaces, dashes, or underscores. It is also known as SpongeCase or Mocking Spongebob Case.
Commonly used in: Joke code and insane asylums.
If it’s your favorite case, what it says about you: You’re a Batman villain and you’re waiting for him to figure out your latest plan, so you thought you’d do some learning on the side.