4 ms·
EyeTracking Study: camelCase vs. under_score style (2010) [pdf]
- melling 8y agosnake case... I did it for years in Perl then moved to camel with Java. Now, I sort of like not having to type underscores.
- charlesism 8y agoI went the other way. I like it when my code doesn't look like a jumble of random letters with the least important words capitalized.
- Mateon1 8y agoI went back and forth, both ways. I started out in Python with snake_case identifiers, then moved to Javascript with camelCase, and now I mostly use Rust with snake_case for names and UpperCamelCase for types. I don't find either style better than the other, the only time I notice anything is when I switch between style conventions (e.g. switch between JS and Rust or C++), because I need to break the habit of typing one way rather than the other. Still, I find readability of the two styles pretty much identical at all times once you get used to both.
- sethammons 8y agoI mostly find the readability the same, except for acronyms in the middle. RemoteHTTPIPAddr vs remote_http_ip_addr. I prefer the latter, but my go-to language these days encourages the former.
- sixhobbits 8y agoThe "What is an acronym really and when should it be capitalised" debate is grey enough that it's easier to consistently use RemoteHttpIpAddr
- lern_too_spel 8y agoNot capitalizing the entire acronym is the convention in modern Java and C#. https://google.github.io/styleguide/javaguide.html#s5.3-camel-case https://google.github.io/styleguide/javaguide.html#s5.3-came... https://docs.microsoft.com/en-us/previous-versions/ms182249%28v%3dvs.80%29 https://docs.microsoft.com/en-us/previous-versions/ms182249%...
- renox 8y agoI work in telecoms where there are so many acronyms that snakeCase is really painful (but we still use it). As for your second example, why not remote_HTTP_IP_addr ? Even more readable IMHO.
- crazyfundu 8y agoFor me it's more about ease in typing. I find typing underscore so many times a bug deterrent in fast typing speed.
- pzone 8y agoMy current style convention mixes several naming styles to help in distinguishing code visually. I prefer camelCase for variables, which need to be typed repeatedly, and camel is fastest to type. I use snake_case for functions, UpperCamelCase for classes/types, and ALL_CAPS_SNAKE for configuration variables a user would be expected to edit.
- ChrisRR 8y agoWhat language is that in? Conventions tend to follow with programming languages. In C, snake case is historically the default, but I tend to use UpperCamelCase for functions, UpperCamelCase for file-level static variables, lowerCamelCase for function-level static variables and ALL_CAPS_SNAKE for #defines.
- charlesism 8y agocamel is fastest to type iAgree but englishIsAlso fasterToType byRemovingSpacesAnd capitalizingFewerWordsThan usual. iDonT knowWhy weProgrammers shouldConsiderThat aWorthwhile tradeOff
- Jemm 8y agoiThink theGermansWouldAgree.
- lizmat 8y agoIn Perl 6, you can also use "kebab-case": my $is-it-time = True; The hyphen is allowed inside an identifier as long as it is not the first and as long as it is followed by at least one letter. my $foo-42; # interpreted as my $foo - 42