Programming Naming Conventions: camelCase vs snake_case vs PascalCase
Different programming languages use different naming conventions for variables, functions, and classes. Using the wrong convention creates inconsistent code and can cause bugs.
camelCase: First word lowercase, subsequent words capitalized. Examples: userName, getUserData, isLoggedIn. Used by JavaScript, TypeScript, and Java (for methods/variables). The name comes from the "humps" created by capital letters in the middle.
PascalCase: Every word capitalized, including the first. Examples: UserName, UserController, HttpClient. Used by C#, Java (for classes), and React (for components). Sometimes called UpperCamelCase.
snake_case: All lowercase, words separated by underscores. Examples: user_name, get_user_data, is_logged_in. Used by Python, Ruby, Rust, and database column names. Preferred when spaces would cause ambiguity.
kebab-case: All lowercase, words separated by hyphens. Examples: user-name, get-user-data, main-content. Used in CSS class names, URLs, and HTML attributes. Cannot be used in most programming languages because hyphens are the subtraction operator.
SCREAMING_SNAKE_CASE: All uppercase with underscores. Examples: MAX_RETRY_COUNT, API_BASE_URL. Used for constants and environment variables across most languages.
Quick language reference: JavaScript/TypeScript: camelCase (variables), PascalCase (classes/components). Python: snake_case (everything), PascalCase (classes). C#/Java: PascalCase (classes/methods), camelCase (variables). CSS: kebab-case. Use Tooler's Case Converter to switch between conventions instantly.