15 comments

[ 2.8 ms ] story [ 43.8 ms ] thread
snake case...

I did it for years in Perl then moved to camel with Java. Now, I sort of like not having to type underscores.

I 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.
I 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.

I 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.
I 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.
For me it's more about ease in typing. I find typing underscore so many times a bug deterrent in fast typing speed.
My 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.

What 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.

    camel is fastest to type
iAgree but englishIsAlso fasterToType byRemovingSpacesAnd capitalizingFewerWordsThan usual. iDonT knowWhy weProgrammers shouldConsiderThat aWorthwhile tradeOff
iThink theGermansWouldAgree.
In 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
This is also the standard for Common Lisp, Scheme, emacs-lisp.
Also Bash (for function names) (could be POSIX too), Make ...