Page 3 of 3

Re: Underscores vs CamelCase

Posted: Thu Oct 09, 2014 4:30 am UTC
by Thesh
EvanED wrote:But that's an easy choice for C++ because using lowercase_underscores for everything (even types) is almost as dumb and annoying as the .Net style of UpperCamel for everything (even methods). :-)


.Net style is to usw lowerCamel for method parameters.

Re: Underscores vs CamelCase

Posted: Fri Oct 10, 2014 12:32 am UTC
by Sinaelnikova
I dont want to live on this planet anymore

Re: Underscores vs CamelCase

Posted: Sat Oct 11, 2014 1:36 am UTC
by Nyktos
Derek wrote:
Nyktos wrote:Python standardized on underscores (with UpperCamelCase for classes) over a decade ago. There are a few prominent projects (Twisted and various Zope things) that use camel case, but those are all ancient.

Python's collections have the following types:

namedtuple
deque
Counter
OrderedDict
defaultdict

Thus showing two styles of type name in one module (neither of which is using underscores). Maybe the functions and variables are standardized on underscores, but if type names aren't consistent that still means the naming scheme is inconsistent.
The collections module is using older naming conventions.* If you look at more recently added stdlib modules, they use the convention I described, as do do the vast majority of popular third-party packages.

* It doesn't actually predate PEP 8 itself, though, as I'd assumed. I'm not sure why deque and defaultdict were named that way, but they were the first two things added to the module. namedtuple isn't actually a type.

Re: Underscores vs CamelCase

Posted: Sat Mar 05, 2016 12:42 pm UTC
by Mikemk
iPreferThisStyle
whereTheFirstWordIsLowercase
andEverythingElseIsCamel

psIBetMyUsernameAnnoysThePeopleHere

Re: Underscores vs CamelCase

Posted: Sat Mar 05, 2016 5:01 pm UTC
by ahammel
Nyktos wrote:I'm not sure why deque and defaultdict were named that way, but they were the first two things added to the module. namedtuple isn't actually a type.

'defaultdict', 'deque', and 'namedtuple' are presumably named that way for consistency with the built-in 'dict', 'list', and 'tuple', which is a departure from convention I can live with.

Re: Underscores vs CamelCase

Posted: Fri Mar 11, 2016 5:49 am UTC
by Derek
Mikemk wrote:iPreferThisStyle
whereTheFirstWordIsLowercase
andEverythingElseIsCamel

psIBetMyUsernameAnnoysThePeopleHere

I believe that's called lower camel case, with upper camel case starting with an uppercase letter. In Java and similar languages, types are in upper camel case and variables in lower camel case.

Re: Underscores vs CamelCase

Posted: Fri Mar 11, 2016 2:57 pm UTC
by ahammel
I've always called them camelCase and StudlyCaps

Re: Underscores vs CamelCase

Posted: Tue Mar 15, 2016 2:45 am UTC
by Xanthir
I sometimes say that too, but "StudlyCase" is a stupid name, so I usually say "upper camel-case" instead.

Re: Underscores vs CamelCase

Posted: Tue Mar 15, 2016 3:44 am UTC
by ahammel
Xanthir wrote:I sometimes say that too, but "StudlyCase" is a stupid name[...]

That's true, but if one were to look at it objectively, I think that one would have to conclude that camelCase, kebab-case, and SCREAMING_SNAKE_CASE are also fairly stupid names. At least StudleyCase is in good company :)

Re: Underscores vs CamelCase

Posted: Thu Mar 17, 2016 7:17 am UTC
by Derek
Am I missing a joke with StudleyCase? I don't get that name.

Re: Underscores vs CamelCase

Posted: Fri Mar 18, 2016 2:10 pm UTC
by ahammel
Derek wrote:Am I missing a joke with StudleyCase? I don't get that name.

I too am unclear on the etymology.

Re: Underscores vs CamelCase

Posted: Sat Mar 19, 2016 3:15 pm UTC
by Xanthir

Re: Underscores vs CamelCase

Posted: Sat Mar 19, 2016 4:30 pm UTC
by chridd
It says the origin of the practice is obscure; it doesn't say anything about the etymology. And it seem to be talking about rAnDoM cAPiTAliZAtioN, rather than UpperCamelCase (which it calls BiCapitalization) (although I feel like I have at some point heard StudlyCaps or StudlyCase used to refer to UpperCamelCase).

Re: Underscores vs CamelCase

Posted: Sun Mar 20, 2016 7:01 am UTC
by commodorejohn
Yeah, I remember hearing "StudlyCaps" used back in the late '90s-early '00s, usually by Java zealots when contrasting their OneTrueNamingConvention with C's half-dozen assorted quasi-standards. No idea if that's actually where it originated, but it sounds like a late-'90s Internet coinage to me.

Re: Underscores vs CamelCase

Posted: Fri Apr 01, 2016 9:40 pm UTC
by You, sir, name?
C++ code that does method names with UpperCamel style really just... I don't even comprehend why you would do such a thing.

Of all wrong things you could do, this is up there with re-animating the corpse of Hitler and electing him Litch Chancellor.

Re: Underscores vs CamelCase

Posted: Sun Apr 03, 2016 3:20 pm UTC
by commodorejohn
That's how you tell that it's C++ written by someone who'd really rather be using Java.

Re: Underscores vs CamelCase

Posted: Sun Apr 03, 2016 4:34 pm UTC
by You, sir, name?
I've never seen anyone do it in Java. I don't understand where it's coming from.

Re: Underscores vs CamelCase

Posted: Mon Apr 04, 2016 8:30 am UTC
by Xenomortis
C# does that.
As does the entire Win32 API?

Re: Underscores vs CamelCase

Posted: Wed Apr 06, 2016 5:59 am UTC
by ConMan
If you regularly code in R, then you separate words with periods, to make.other.programmers.cry

Re: Underscores vs CamelCase

Posted: Sun Apr 10, 2016 3:24 am UTC
by heuristically_alone
I, like Robert_Frost, prefer to take the road less taken, and that indeed has made all the difference.

Re: Underscores vs CamelCase

Posted: Tue Apr 12, 2016 10:47 pm UTC
by Derek
heuristically_alone wrote:I, like Robert_Frost, prefer to take the road less taken, and that indeed has made all the difference.

I assume by that you mean that it's gotten you fired from all your jobs.

Re: Underscores vs CamelCase

Posted: Wed Apr 13, 2016 8:31 pm UTC
by stopmadnessnow
No Derek, because it's only one fork in the road. It's not necessarily an attitude problem that heuristically_alone has.

Re: Underscores vs CamelCase

Posted: Wed Apr 20, 2016 10:05 am UTC
by Derek
stopmadnessnow wrote:No Derek, because it's only one fork in the road. It's not necessarily an attitude problem that heuristically_alone has.

The problem is not one of attitude, but of coding style. Anyone who mixes camelcase with underscore in the same name deserves to be taken out back and shot!

Re: Underscores vs CamelCase

Posted: Thu Oct 05, 2017 6:59 pm UTC
by SuicideJunkie
ConMan wrote:If you regularly code in R, then you separate words with periods, to make.other.programmers.cry
Is this what is known as "sentence structure"?


The best is/was SE5 script style. Take your camel case, add underscores, and prefix almost everything with sys_
EG: Sys_Add_Two_Integers()

I wrote a script to make a mod to wrap those functions with more sensibly named functions.

Re: Underscores vs CamelCase

Posted: Thu Apr 19, 2018 1:31 pm UTC
by jgh
Typically sitting on the liberal fence, I use both:
net_Tx
net_TxCount
net_RxOpen
net_RxRead
phone_FromStr
phone_ToStr
reg_RdInt
reg_RdStr
etc.
Consistantly (component)_(subfunction)

Re: Underscores vs CamelCase

Posted: Fri Jul 27, 2018 4:53 am UTC
by serutan
I would have sworn that the FUBAR method of doing names was known as Hungarian Notation rather than CamelCase...

Re: Underscores vs CamelCase

Posted: Fri Jul 27, 2018 5:33 am UTC
by commodorejohn
Hungarian notation is a different and altogether weirder convention.

Re: Underscores vs CamelCase

Posted: Fri Jul 27, 2018 3:56 pm UTC
by pogrmman
I hate camelCase, but I will use whatever complies with the style of the codebase and language I’m working on. For python, for instance, I use UpperCamelCase for classes and underscore_case for methods, but nowhere do I use camelCase.

The objectively superior one is clearly lispish-kebab-case though. You don’t ever have to press shift using a us keyboard layout, so it’s easier on the hands :p. kebab-case and underscore_case are both objectively easier to read than camelCase imo.