[{"data":1,"prerenderedAt":1124},["ShallowReactive",2],{"blog-en-camelcase-vs-snakecase":3},{"id":4,"title":5,"alt":6,"author":7,"body":8,"category":1087,"description":1088,"extension":1089,"faq":1090,"image":1112,"meta":1113,"navigation":667,"path":1114,"publishedAt":1115,"seo":1116,"stem":1117,"tags":1118,"__hash__":1123},"blog\u002Fen\u002Fcamelcase-vs-snakecase.md","camelCase vs snake_case: When to Use Which (With Examples)","Side-by-side comparison of camelCase and snake_case variable naming conventions with language icons","Vibe Apps Pro Team",{"type":9,"value":10,"toc":1077},"minimark",[11,20,23,26,31,34,314,317,319,323,335,340,365,378,392,394,398,408,412,439,445,478,480,484,487,493,507,521,527,534,537,547,549,553,556,562,745,759,764,810,827,837,853,861,863,867,901,927,948,976,978,982,985,1009,1015,1023,1025,1029,1067,1073],[12,13,14,15,19],"p",{},"The answer takes about 30 seconds to give and a career to fully internalize: ",[16,17,18],"strong",{},"use what the language community already decided",". camelCase in JavaScript. snake_case in Python. Done.",[12,21,22],{},"But the real complexity is at the boundaries — JSON APIs, database schemas, config files, and cross-language projects where two communities collide. That's where things get messy, and that's what this article covers.",[24,25],"hr",{},[27,28,30],"h2",{"id":29},"quick-reference-which-convention-goes-where","Quick Reference: Which Convention Goes Where",[12,32,33],{},"Before diving into the why, here's the definitive lookup table:",[35,36,37,53],"table",{},[38,39,40],"thead",{},[41,42,43,47,50],"tr",{},[44,45,46],"th",{},"Context",[44,48,49],{},"Convention",[44,51,52],{},"Example",[54,55,56,75,91,107,122,138,154,167,180,194,211,225,239,254,269,284,299],"tbody",{},[41,57,58,62,65],{},[59,60,61],"td",{},"JavaScript variables \u002F functions",[59,63,64],{},"camelCase",[59,66,67,71,72],{},[68,69,70],"code",{},"wordCount",", ",[68,73,74],{},"parseText()",[41,76,77,80,83],{},[59,78,79],{},"JavaScript classes",[59,81,82],{},"PascalCase",[59,84,85,71,88],{},[68,86,87],{},"TextAnalyzer",[68,89,90],{},"WordCounter",[41,92,93,96,99],{},[59,94,95],{},"JavaScript constants",[59,97,98],{},"UPPER_SNAKE_CASE",[59,100,101,71,104],{},[68,102,103],{},"MAX_WORDS",[68,105,106],{},"DEFAULT_WPM",[41,108,109,112,114],{},[59,110,111],{},"TypeScript interfaces \u002F types",[59,113,82],{},[59,115,116,71,119],{},[68,117,118],{},"TextStats",[68,120,121],{},"AnalysisResult",[41,123,124,127,130],{},[59,125,126],{},"TypeScript \u002F Vue file names",[59,128,129],{},"kebab-case",[59,131,132,71,135],{},[68,133,134],{},"word-counter.ts",[68,136,137],{},"text-analyzer.vue",[41,139,140,143,146],{},[59,141,142],{},"Python variables \u002F functions",[59,144,145],{},"snake_case",[59,147,148,71,151],{},[68,149,150],{},"word_count",[68,152,153],{},"parse_text()",[41,155,156,159,161],{},[59,157,158],{},"Python classes",[59,160,82],{},[59,162,163,71,165],{},[68,164,87],{},[68,166,90],{},[41,168,169,172,174],{},[59,170,171],{},"Python constants",[59,173,98],{},[59,175,176,71,178],{},[68,177,103],{},[68,179,106],{},[41,181,182,185,187],{},[59,183,184],{},"Ruby \u002F Rails",[59,186,145],{},[59,188,189,71,191],{},[68,190,150],{},[68,192,193],{},"parse_text",[41,195,196,199,202],{},[59,197,198],{},"Go",[59,200,201],{},"camelCase \u002F PascalCase",[59,203,204,206,207,210],{},[68,205,70],{}," (unexported), ",[68,208,209],{},"WordCount"," (exported)",[41,212,213,216,218],{},[59,214,215],{},"Java \u002F Kotlin public methods",[59,217,64],{},[59,219,220,71,223],{},[68,221,222],{},"getWordCount()",[68,224,74],{},[41,226,227,230,232],{},[59,228,229],{},"SQL column names",[59,231,145],{},[59,233,234,71,236],{},[68,235,150],{},[68,237,238],{},"created_at",[41,240,241,244,246],{},[59,242,243],{},"CSS class names",[59,245,129],{},[59,247,248,71,251],{},[68,249,250],{},"word-counter",[68,252,253],{},"text-toolbar",[41,255,256,259,261],{},[59,257,258],{},"URL slugs",[59,260,129],{},[59,262,263,71,266],{},[68,264,265],{},"\u002Fcase-converter",[68,267,268],{},"\u002Fremove-spaces",[41,270,271,274,276],{},[59,272,273],{},"npm package names",[59,275,129],{},[59,277,278,71,281],{},[68,279,280],{},"nuxt-gtag",[68,282,283],{},"vue-router",[41,285,286,289,292],{},[59,287,288],{},"JSON REST API keys",[59,290,291],{},"camelCase (JS-first) or snake_case (Python-first)",[59,293,294,296,297],{},[68,295,70],{}," \u002F ",[68,298,150],{},[41,300,301,304,306],{},[59,302,303],{},"Environment variables",[59,305,98],{},[59,307,308,71,311],{},[68,309,310],{},"NODE_ENV",[68,312,313],{},"API_SECRET",[12,315,316],{},"Bookmark that table. It covers 95% of the decisions you'll make on a given project.",[24,318],{},[27,320,322],{"id":321},"camelcase-the-javascript-and-java-choice","camelCase: The JavaScript and Java Choice",[12,324,325,326,71,328,71,331,334],{},"camelCase concatenates words by capitalizing the first letter of each word after the first: ",[68,327,70],{},[68,329,330],{},"parseText",[68,332,333],{},"maxRetries",".",[12,336,337],{},[16,338,339],{},"Where it's the law:",[341,342,343,347,350,353,356],"ul",{},[344,345,346],"li",{},"JavaScript and TypeScript variables, functions, and object properties",[344,348,349],{},"Java instance methods and variables",[344,351,352],{},"Objective-C methods",[344,354,355],{},"JSON keys consumed by JavaScript frontends (by convention, not spec)",[344,357,358,359,361,362,364],{},"Go unexported identifiers (",[68,360,70],{},") and exported identifiers via PascalCase (",[68,363,209],{},")",[12,366,367,368,71,371,71,374,377],{},"The origin of camelCase in JavaScript traces directly to Java. Brendan Eich designed JavaScript's syntax to appeal to Java developers in 1995, and JavaScript's built-in APIs followed Java's convention: ",[68,369,370],{},"getElementById",[68,372,373],{},"addEventListener",[68,375,376],{},"hasOwnProperty",". Fifteen years of browser APIs trained an entire generation to type camelCase instinctively.",[12,379,380,383,384,71,386,71,389,391],{},[16,381,382],{},"The PascalCase variant"," (UpperCamelCase) capitalizes every word, including the first: ",[68,385,87],{},[68,387,388],{},"HttpRequest",[68,390,90],{},". In JavaScript, PascalCase signals \"this is a constructor or class.\" In C# and Java, it's used for all public methods — a gotcha when you first read .NET source code coming from a JS background.",[24,393],{},[27,395,397],{"id":396},"snake_case-the-python-and-database-choice","snake_case: The Python and Database Choice",[12,399,400,401,71,403,71,405,334],{},"snake_case lowercases everything and separates words with underscores: ",[68,402,150],{},[68,404,193],{},[68,406,407],{},"max_retries",[12,409,410],{},[16,411,339],{},[341,413,414,417,420,423,426,436],{},[344,415,416],{},"Python variables, functions, and module names (PEP 8 — non-negotiable in any serious Python project)",[344,418,419],{},"Ruby and Rails methods and variables",[344,421,422],{},"PostgreSQL and MySQL column names (enforced by convention, not the DB engine)",[344,424,425],{},"Rust variables and functions",[344,427,428,429,71,432,435],{},"C standard library functions (",[68,430,431],{},"printf",[68,433,434],{},"strlen"," — technically no separator, but single words)",[344,437,438],{},"Environment variable names in UPPER_SNAKE_CASE variant",[12,440,441,444],{},[16,442,443],{},"Why Python chose snake_case:"," Guido van Rossum wrote PEP 8 in 2001 to describe the style already used in Python's standard library. The library predated PEP 8, and it used snake_case because Unix utilities and C had established that pattern for multi-word identifiers. Python simply codified existing practice.",[12,446,447,450,451,453,454,457,458,461,462,465,466,469,470,474,475,477],{},[16,448,449],{},"The PostgreSQL trap with camelCase columns:"," SQL is case-insensitive by spec, and PostgreSQL folds every unquoted identifier to lowercase at parse time. If you create a column named ",[68,452,70],{},", Postgres stores it as ",[68,455,456],{},"wordcount",". Your ",[68,459,460],{},"SELECT wordCount FROM ..."," query silently works — until a junior dev writes ",[68,463,464],{},"SELECT \"wordCount\" FROM ..."," with quotes, gets a ",[68,467,468],{},"column \"wordCount\" does not exist"," error, and spends an hour debugging. The fix is to always quote it, which then means you must quote it ",[471,472,473],"em",{},"everywhere"," forever. ",[68,476,150],{}," has no such trap — it survives the case fold intact. Use snake_case and save yourself the bikeshedding. snake_case also aligns with how ORMs like SQLAlchemy, Prisma, and ActiveRecord generate migration column names by default.",[24,479],{},[27,481,483],{"id":482},"the-api-boundary-problem","The API Boundary Problem",[12,485,486],{},"This is where most teams make mistakes.",[12,488,489,490],{},"A Python backend (snake_case) serving a JavaScript frontend (camelCase) creates a decision: ",[16,491,492],{},"whose convention wins at the API layer?",[12,494,495,498,499,502,503,506],{},[16,496,497],{},"Option 1: snake_case throughout","\nThe backend returns ",[68,500,501],{},"{ \"word_count\": 432 }",". The frontend accesses ",[68,504,505],{},"response.word_count",". This works, but it feels wrong in JavaScript — properties that look like Python. If you're using TypeScript, your interfaces now have snake_case keys, which stands out against every JavaScript convention.",[12,508,509,512,513,516,517,520],{},[16,510,511],{},"Option 2: camelCase throughout","\nThe backend serializes to ",[68,514,515],{},"{ \"wordCount\": 432 }",". FastAPI does this automatically with ",[68,518,519],{},"alias_generator",". Django REST Framework supports it via a custom renderer. The frontend gets native-looking keys.",[12,522,523,526],{},[16,524,525],{},"Option 3: pick a standard and stick to it","\nJSON:API spec uses camelCase. OpenAPI recommendations favor camelCase. GraphQL (schema and queries) is strictly camelCase by convention. If you're building a public API, camelCase is what most SDK generators expect.",[12,528,529,530,533],{},"The worst option: mixing them. ",[68,531,532],{},"{ \"wordCount\": 432, \"created_at\": \"2026-05-13\" }"," — this is what happens when two people wrote the serializer without talking. Normalize at the serializer layer, not the client.",[12,535,536],{},"Here's how the three options look in practice:",[538,539,544],"pre",{"className":540,"code":542,"language":543},[541],"language-text","┌─────────────────────────────────────────────────────────────┐\n│                    API BOUNDARY OPTIONS                     │\n├───────────────┬─────────────────┬───────────────────────────┤\n│ Option        │ API Response    │ Frontend access            │\n├───────────────┼─────────────────┼───────────────────────────┤\n│ snake_case    │ word_count: 432 │ response.word_count        │\n│ camelCase     │ wordCount: 432  │ response.wordCount  ✓      │\n│ Mixed (avoid) │ wordCount: 432, │ response.wordCount +       │\n│               │ created_at: …   │ response.created_at  ✗    │\n└───────────────┴─────────────────┴───────────────────────────┘\n","text",[68,545,542],{"__ignoreMap":546},"",[24,548],{},[27,550,552],{"id":551},"converting-between-conventions","Converting Between Conventions",[12,554,555],{},"At some point you'll need to convert — either refactoring a codebase, adapting a third-party API response, or migrating a database schema.",[12,557,558,561],{},[16,559,560],{},"The regex approach"," is the most reliable way to convert camelCase to snake_case programmatically:",[538,563,567],{"className":564,"code":565,"language":566,"meta":546,"style":546},"language-js shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F camelCase → snake_case\nconst toSnakeCase = (str) =>\n  str.replace(\u002F([a-z])([A-Z])\u002Fgu, '$1_$2').toLowerCase()\n\n\u002F\u002F snake_case → camelCase\nconst toCamelCase = (str) =>\n  str.replace(\u002F_([a-z])\u002Fgu, (_, c) => c.toUpperCase())\n","js",[68,568,569,578,605,662,669,675,693],{"__ignoreMap":546},[570,571,574],"span",{"class":572,"line":573},"line",1,[570,575,577],{"class":576},"sHwdD","\u002F\u002F camelCase → snake_case\n",[570,579,581,585,589,593,596,600,602],{"class":572,"line":580},2,[570,582,584],{"class":583},"spNyl","const",[570,586,588],{"class":587},"sTEyZ"," toSnakeCase ",[570,590,592],{"class":591},"sMK4o","=",[570,594,595],{"class":591}," (",[570,597,599],{"class":598},"sHdIc","str",[570,601,364],{"class":591},[570,603,604],{"class":583}," =>\n",[570,606,608,611,613,617,620,623,627,630,633,636,640,643,646,649,652,654,656,659],{"class":572,"line":607},3,[570,609,610],{"class":587},"  str",[570,612,334],{"class":591},[570,614,616],{"class":615},"s2Zo4","replace",[570,618,619],{"class":587},"(",[570,621,622],{"class":591},"\u002F([",[570,624,626],{"class":625},"sfazB","a-z",[570,628,629],{"class":591},"])([",[570,631,632],{"class":625},"A-Z",[570,634,635],{"class":591},"])\u002F",[570,637,639],{"class":638},"sbssI","gu",[570,641,642],{"class":591},",",[570,644,645],{"class":591}," '",[570,647,648],{"class":625},"$1_$2",[570,650,651],{"class":591},"'",[570,653,364],{"class":587},[570,655,334],{"class":591},[570,657,658],{"class":615},"toLowerCase",[570,660,661],{"class":587},"()\n",[570,663,665],{"class":572,"line":664},4,[570,666,668],{"emptyLinePlaceholder":667},true,"\n",[570,670,672],{"class":572,"line":671},5,[570,673,674],{"class":576},"\u002F\u002F snake_case → camelCase\n",[570,676,678,680,683,685,687,689,691],{"class":572,"line":677},6,[570,679,584],{"class":583},[570,681,682],{"class":587}," toCamelCase ",[570,684,592],{"class":591},[570,686,595],{"class":591},[570,688,599],{"class":598},[570,690,364],{"class":591},[570,692,604],{"class":583},[570,694,696,698,700,702,704,707,710,713,715,717,719,721,723,725,727,730,732,735,737,739,742],{"class":572,"line":695},7,[570,697,610],{"class":587},[570,699,334],{"class":591},[570,701,616],{"class":615},[570,703,619],{"class":587},[570,705,706],{"class":591},"\u002F",[570,708,709],{"class":625},"_",[570,711,712],{"class":591},"([",[570,714,626],{"class":625},[570,716,635],{"class":591},[570,718,639],{"class":638},[570,720,642],{"class":591},[570,722,595],{"class":591},[570,724,709],{"class":598},[570,726,642],{"class":591},[570,728,729],{"class":598}," c",[570,731,364],{"class":591},[570,733,734],{"class":583}," =>",[570,736,729],{"class":587},[570,738,334],{"class":591},[570,740,741],{"class":615},"toUpperCase",[570,743,744],{"class":587},"())\n",[12,746,747,748,751,752,755,756,758],{},"The key pattern is ",[68,749,750],{},"([a-z])([A-Z])"," — it matches every transition from lowercase to uppercase, which is exactly a camelCase boundary. Note the ",[68,753,754],{},"u"," flag: while this specific pattern only targets ASCII letters, building the ",[68,757,754],{}," flag habit matters for any pattern that handles Unicode text.",[12,760,761],{},[16,762,763],{},"VS Code step-by-step (no plugin needed):",[765,766,767,778,785,793,800,803],"ol",{},[344,768,769,770,773,774,777],{},"Open Find & Replace: ",[68,771,772],{},"Ctrl+H"," (Windows\u002FLinux) or ",[68,775,776],{},"⌘+H"," (Mac)",[344,779,780,781,784],{},"Click the ",[68,782,783],{},".*"," icon to enable regex mode",[344,786,787,790,791],{},[16,788,789],{},"Find:"," ",[68,792,750],{},[344,794,795,790,798],{},[16,796,797],{},"Replace:",[68,799,648],{},[344,801,802],{},"Hit Replace All — this inserts underscores at every camelCase boundary",[344,804,805,806,809],{},"Open the terminal and run the file through a lowercase pass, or do a second Find All → ",[68,807,808],{},"[A-Z]"," → lowercase manually",[12,811,812,813,816,817,820,821,823,824,826],{},"The ",[68,814,815],{},"$1"," and ",[68,818,819],{},"$2"," in the replacement string reference the two capture groups in the pattern — ",[68,822,815],{}," is the lowercase letter before the boundary, ",[68,825,819],{}," is the uppercase letter after it. A lot of devs don't realize VS Code's regex replace supports capture group back-references out of the box, no extension needed.",[12,828,829,830,836],{},"For one-off conversions, paste your identifier into our ",[16,831,832],{},[833,834,835],"a",{"href":265},"Case Converter"," — runs 100% in your browser, zero data sent to any server — and pick the output format from the dropdown.",[12,838,839,840,846,847,849,850,852],{},"For bulk renaming across a document or pasted code block, use ",[16,841,842],{},[833,843,845],{"href":844},"\u002Ffind-replace","Find & Replace"," with the regex ",[68,848,750],{}," → ",[68,851,648],{}," to convert camelCase to snake_case, then follow up with a second pass to lowercase. The tool supports full regex with capture group substitution and shows a live match count before you commit.",[12,854,855,856,860],{},"If you're curious how the regex approach compares to other text processing patterns, the ",[833,857,859],{"href":858},"\u002Fblog\u002Fregex-find-replace-guide","regex find & replace guide"," covers capture groups, quantifiers, and lookaheads in detail.",[24,862],{},[27,864,866],{"id":865},"the-edge-cases-that-trip-everyone-up","The Edge Cases That Trip Everyone Up",[12,868,869,872,873,876,877,880,881,876,884,887,888,71,890,892,893,896,897,900],{},[16,870,871],{},"Acronyms in camelCase:"," Should it be ",[68,874,875],{},"parseHTML"," or ",[68,878,879],{},"parseHtml","? ",[68,882,883],{},"getURL",[68,885,886],{},"getUrl","? Google's Java style guide says treat acronyms as words: ",[68,889,879],{},[68,891,886],{},". Microsoft's C# guide says keep them uppercase if they're 2 characters: ",[68,894,895],{},"GetIO",", but ",[68,898,899],{},"GetUrl",". JavaScript has no universal rule. Pick one and document it — inconsistency within a codebase is the actual problem.",[12,902,903,790,906,876,909,912,913,71,915,918,919,922,923,926],{},[16,904,905],{},"Numbers in identifiers:",[68,907,908],{},"base64Encode",[68,910,911],{},"base_64_encode","? The convention is to treat numbers as lowercase word characters: ",[68,914,908],{},[68,916,917],{},"to_utf8",". Some teams write ",[68,920,921],{},"toUtf8",", some ",[68,924,925],{},"toUTF8"," — again, the style guide matters more than the individual choice.",[12,928,929,790,932,935,936,939,940,943,944,947],{},[16,930,931],{},"Leading underscores:",[68,933,934],{},"_privateMethod"," is a JavaScript convention (not enforced by the language) to signal \"don't call this from outside the module.\" Python uses a single leading underscore (",[68,937,938],{},"_private",") the same way, and double underscore (",[68,941,942],{},"__mangled",") triggers name mangling in classes. In modern JavaScript with ",[68,945,946],{},"#privateField"," syntax, the underscore convention is largely obsolete, but you'll still see it in older codebases.",[12,949,950,953,954,957,958,876,961,964,965,71,968,971,972,975],{},[16,951,952],{},"Database primary keys:"," Most frameworks expect ",[68,955,956],{},"id",", not ",[68,959,960],{},"Id",[68,962,963],{},"ID",". Foreign keys follow the pattern ",[68,966,967],{},"user_id",[68,969,970],{},"post_id"," — snake_case with ",[68,973,974],{},"_id"," suffix. Keep this consistent or your ORM will generate queries that don't match your schema.",[24,977],{},[27,979,981],{"id":980},"a-note-on-tooling-enforcement","A Note on Tooling Enforcement",[12,983,984],{},"The most important property of a naming convention is that you don't have to think about it. If your team argues about case in code review, you're spending mental energy on the wrong thing.",[12,986,987,990,991,816,994,997,998,1001,1002,816,1005,1008],{},[16,988,989],{},"ESLint"," has ",[68,992,993],{},"camelcase",[68,995,996],{},"@typescript-eslint\u002Fnaming-convention"," rules that enforce casing at the linter level. ",[16,999,1000],{},"Black"," (Python formatter) doesn't rename variables, but ",[16,1003,1004],{},"pylint",[16,1006,1007],{},"flake8"," with PEP 8 plugins will flag snake_case violations. Set up the linter rule once, enforce on CI, and the conversation ends.",[12,1010,1011,1012,1014],{},"For ad-hoc text work — API responses, config files, migration scripts — the ",[833,1013,835],{"href":265}," handles all common formats including camelCase, snake_case, PascalCase, kebab-case, and UPPER_SNAKE_CASE in a single click.",[12,1016,1017,1018,1022],{},"And if you've ever pasted a blob of text with inconsistent casing and needed to normalize it, the approach in the ",[833,1019,1021],{"href":1020},"\u002Fblog\u002Fhow-to-remove-extra-spaces-from-text-online","how to remove extra spaces from text online"," article applies here too — clean the text first, then transform.",[24,1024],{},[27,1026,1028],{"id":1027},"the-short-answer","The Short Answer",[341,1030,1031,1037,1043,1049,1055,1061],{},[344,1032,1033,1036],{},[16,1034,1035],{},"JavaScript \u002F TypeScript:"," camelCase for variables and functions, PascalCase for classes",[344,1038,1039,1042],{},[16,1040,1041],{},"Python:"," snake_case for variables and functions, PascalCase for classes, PEP 8 is not optional",[344,1044,1045,1048],{},[16,1046,1047],{},"SQL \u002F Databases:"," snake_case, always",[344,1050,1051,1054],{},[16,1052,1053],{},"CSS \u002F URLs \u002F npm:"," kebab-case",[344,1056,1057,1060],{},[16,1058,1059],{},"Environment variables:"," UPPER_SNAKE_CASE",[344,1062,1063,1066],{},[16,1064,1065],{},"JSON APIs:"," camelCase if JS-first, snake_case if Python-first — pick one and serialize consistently",[12,1068,1069,1070,1072],{},"When you're working across layers and need to convert quickly, the ",[833,1071,835],{"href":265}," handles all formats without leaving the browser.",[1074,1075,1076],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":546,"searchDepth":580,"depth":580,"links":1078},[1079,1080,1081,1082,1083,1084,1085,1086],{"id":29,"depth":580,"text":30},{"id":321,"depth":580,"text":322},{"id":396,"depth":580,"text":397},{"id":482,"depth":580,"text":483},{"id":551,"depth":580,"text":552},{"id":865,"depth":580,"text":866},{"id":980,"depth":580,"text":981},{"id":1027,"depth":580,"text":1028},"Dev Tools","camelCase or snake_case? The answer depends on your language, layer, and team convention. Full breakdown with language rules, API gotchas, and a conversion tool.","md",[1091,1094,1097,1100,1103,1106,1109],{"question":1092,"answer":1093},"Is camelCase or snake_case more readable?","Research is split, but context matters more than preference. Eye-tracking studies show snake_case is slightly faster to read for long identifiers because the underscores create clear visual separation — similar to spaces. camelCase is faster to type (no Shift key for underscore). Most readability differences disappear at identifier lengths under 15 characters. The real answer: match whatever the language community has already standardized.",{"question":1095,"answer":1096},"Which naming convention does JavaScript use?","JavaScript uses camelCase for variables, function names, and object properties (const wordCount, function parseText). PascalCase (a.k.a. UpperCamelCase) is reserved for classes and constructors (class TextAnalyzer). Constants are often UPPER_SNAKE_CASE (const MAX_WORDS = 50000). JavaScript itself uses camelCase in all its built-in APIs: getElementById, addEventListener, querySelector.",{"question":1098,"answer":1099},"Which naming convention does Python use?","PEP 8 — the Python style guide — specifies snake_case for variables, function names, and module names (word_count, parse_text, my_module). PascalCase for class names (TextAnalyzer). UPPER_SNAKE_CASE for constants (MAX_WORDS). Python's standard library follows PEP 8 almost universally, which creates strong community pressure to do the same.",{"question":1101,"answer":1102},"What naming convention should I use for REST API JSON keys?","camelCase is more common for JSON APIs consumed by JavaScript clients — it eliminates the need for key transformation on the frontend. However, many Python-first APIs (Django REST Framework, FastAPI by default) return snake_case keys. The real problem arises when you mix them: a Python backend returning snake_case to a JavaScript frontend creates a translation layer. Pick one for the whole stack, or configure serialization consistently.",{"question":1104,"answer":1105},"What is PascalCase and how is it different from camelCase?","PascalCase (also called UpperCamelCase) capitalizes the first letter of every word including the first: TextAnalyzer, WordCounter, HttpRequest. Regular camelCase (lowerCamelCase) starts lowercase: textAnalyzer, wordCounter, httpRequest. The distinction matters: JavaScript uses camelCase for functions\u002Fvariables but PascalCase for classes. C# and Java use PascalCase for public methods — which surprises JS developers crossing over.",{"question":1107,"answer":1108},"What about kebab-case? When is that used?","kebab-case uses hyphens: word-counter, text-analyzer, my-component. It's the standard for CSS class names, HTML attributes, URL slugs, and npm package names. You can't use kebab-case for JavaScript variable names (the hyphen is the minus operator), which is why CSS-in-JS and Vue's single-file components allow both — kebab-case in templates, camelCase in script. File naming in some projects also uses kebab-case (word-counter.ts).",{"question":1110,"answer":1111},"How do I bulk-convert camelCase identifiers to snake_case?","The most reliable approach is regex find-and-replace. The pattern ([a-z])([A-Z]) matches every transition from a lowercase letter to an uppercase letter — a camelCase boundary. Replace with $1_$2 (or \\1_\\2 in some engines) then lowercase the result. In VS Code: Ctrl+H, enable regex, search ([a-z])([A-Z]), replace $1_$2. For bulk conversion across files, use the Find & Replace tool at \u002Ffind-replace with the same pattern.","\u002Farticles\u002Fcamelcase-vs-snakecase\u002Fhero.webp",{},"\u002Fen\u002Fcamelcase-vs-snakecase","2026-05-13",{"title":5,"description":1088},"en\u002Fcamelcase-vs-snakecase",[1119,993,145,1120,1121,1122],"naming conventions","javascript","python","developer tools","zHWgh67QgBZ3cQc3jv9iyqFC5yphc6ui3xyWa6Y6NTw",1782712871560]