You might have seen many post about clean code is 100x better, or Debates about their favourite variable casing. Let's dive deep into it.
What are Variables?
Variables are named symbolic storage location on memory that stores some value/data.
Rules for naming Variables
- Should only start from the alphabets (a-zA-Z) or underscore(_).
- list itemVariables are Case Sensitive, meaning (myName and Myname) are different variables.
- list itemShould not have white spaces, consider them as hashtags, #hash tag is not same as #hashtag
- list itemYou can't name them as some reserved keywords. (depends on different languages)
- list itemYou can't add special characters.
Above were some of the common rules for naming Variables, some may depend on the Language you are using.
Now let's jump to main point, Naming Conventions.
- camelCase: It was popularised in the 1990s with Java and later JavaScript.
Usage: userName / getUserData (looks like camel hump)
- PascalCase: Famously used in Pascal Languae where identifiers commonly started with uppercase.
Usage: UserName
- snake_case: It is called snake case because underscores make it look like long connecting snake, used in early UNIX systems and C conventions. Popular in Python,Ruby and Databases.
Usage: user_name
- SCREAMING_SNAKE_CASE: All CAPS so "screaming", used in C macros.
Usage: MAX_LIMIT
- kebab-case: Hyphens look like skewers holding word togther making it look like kebab lol, Became common with web URLs and CSS naming.
Usage: user-name
- Train-Case: Words connected with hyphens like train compartments. More common in documentations and titles than code.


