Naming Convention Explored

The different naming convention used in different programming languages are:

  1. CamelCase:

    In CamelCase, compound words are joined without spaces, and each word (except the first) begins with a capital letter. Example: myVariableName or calculateTotalCost. Used in: Java, JavaScript, C#, TypeScript, Ruby, Swift, Kotlin, Go, Rust, PHP (sometimes).

  1. PascalCase: Similar to CamelCase, but the first letter of each word is capitalized. Example: MyClassName or CalculateTotalCost. Used in: C#, Pascal, Delphi, VB.NET, TypeScript (for class and interface names).
  1. snake_case: Words are separated by underscores, and typically all letters are lowercase. Example: my_variable_name or calculate_total_cost. Used in: Python, Ruby (for file and variable names), Rust (for variable and function names), Perl.
  1. kebab-case: Words are separated by hyphens. This convention is commonly used in URLs, filenames, and HTML attributes. Example: my-variable-name or calculate-total-cost. Used in: HTML/CSS (for class and id names), URL paths, some JavaScript frameworks (e.g., React).
  1. UPPERCASE: All letters in a word are capitalized. Example: CONSTANT_VALUE or MAX_LENGTH. Used in: C, C++, Java (for constants), Python (for constants), PHP (for constants)
  1. lowercase: All letters in a word are lowercase. Example: variable or function. Used in: Python (for function and variable names), JavaScript (for function and variable names), Go (for package names and sometimes variable names), Ruby (for method names)