
camelCase, snake_case, kebab-case: Why Naming Conventions Are a Solved Problem You Keep Arguing About
I once reviewed a pull request where a single file used camelCase for JavaScript variables, snake_case for API response fields, PascalCase for one React component, and SCREAMING_SNAKE_CASE for a constant that wasn't actually constant. The developer's explanation was "I used whatever felt natural at the time." Naming conventions exist precisely so you don't have to make that decision at the time. They're a solved problem. The only hard part is picking one per context and sticking to it. The conventions and where they come from camelCase : first word lowercase, subsequent words capitalized. getUserName , isActive , totalCount . The standard in JavaScript, Java, and Swift. The name comes from the humps in the middle of the word, like a camel's back. PascalCase (also called UpperCamelCase): every word capitalized. UserProfile , HttpRequest , DatabaseConnection . Used for class names in most languages, React component names, and C# methods. snake_case : words separated by underscores, all l
Continue reading on Dev.to JavaScript
Opens in a new tab




