Underscores vs CamelCase

Please compose all posts in Emacs.

Moderators: phlip, Moderators General, Prelates

User avatar
Thesh
Made to Fuck Dinosaurs
Posts: 5534
Joined: Tue Jan 12, 2010 1:55 am UTC
Location: Colorado

Re: Underscores vs CamelCase

Postby Thesh » Thu Oct 09, 2014 4:30 am UTC

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.
Honesty replaced by greed, they gave us the reason to fight and bleed
They try to torch our faith and hope, spit at our presence and detest our goals

User avatar
Sinaelnikova
Posts: 0
Joined: Sat Sep 27, 2014 4:33 pm UTC
Location: Россия

Re: Underscores vs CamelCase

Postby Sinaelnikova » Fri Oct 10, 2014 12:32 am UTC

I dont want to live on this planet anymore

Nyktos
Posts: 138
Joined: Mon Mar 02, 2009 4:02 pm UTC

Re: Underscores vs CamelCase

Postby Nyktos » Sat Oct 11, 2014 1:36 am UTC

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.

User avatar
Mikemk
Posts: 113
Joined: Tue Feb 11, 2014 7:10 am UTC
Location: Moving furniture'); DROP TABLE OweMyFoot; --

Re: Underscores vs CamelCase

Postby Mikemk » Sat Mar 05, 2016 12:42 pm UTC

iPreferThisStyle
whereTheFirstWordIsLowercase
andEverythingElseIsCamel

psIBetMyUsernameAnnoysThePeopleHere
Computer specs:
Spoiler:
Intel i5-750 (OC 3.33 GHz)
8GB (OC 1333 MHz) (2GB HDD cache)
NVIDIA GT 740 (OC 1149 MHz) 4GB (OC 841 MHz)
480GB SSD (120 HDD cache)
2x2TB HDD (not RAID)
Windows 10
Linux Mint in VM

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: Underscores vs CamelCase

Postby ahammel » Sat Mar 05, 2016 5:01 pm UTC

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.
He/Him/His/Alex
God damn these electric sex pants!

Derek
Posts: 2155
Joined: Wed Aug 18, 2010 4:15 am UTC

Re: Underscores vs CamelCase

Postby Derek » Fri Mar 11, 2016 5:49 am UTC

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.

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: Underscores vs CamelCase

Postby ahammel » Fri Mar 11, 2016 2:57 pm UTC

I've always called them camelCase and StudlyCaps
He/Him/His/Alex
God damn these electric sex pants!

User avatar
Xanthir
My HERO!!!
Posts: 5228
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Underscores vs CamelCase

Postby Xanthir » Tue Mar 15, 2016 2:45 am UTC

I sometimes say that too, but "StudlyCase" is a stupid name, so I usually say "upper camel-case" instead.
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: Underscores vs CamelCase

Postby ahammel » Tue Mar 15, 2016 3:44 am UTC

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 :)
He/Him/His/Alex
God damn these electric sex pants!

Derek
Posts: 2155
Joined: Wed Aug 18, 2010 4:15 am UTC

Re: Underscores vs CamelCase

Postby Derek » Thu Mar 17, 2016 7:17 am UTC

Am I missing a joke with StudleyCase? I don't get that name.

User avatar
ahammel
My Little Cabbage
Posts: 2135
Joined: Mon Jan 30, 2012 12:46 am UTC
Location: Vancouver BC
Contact:

Re: Underscores vs CamelCase

Postby ahammel » Fri Mar 18, 2016 2:10 pm UTC

Derek wrote:Am I missing a joke with StudleyCase? I don't get that name.

I too am unclear on the etymology.
He/Him/His/Alex
God damn these electric sex pants!

User avatar
Xanthir
My HERO!!!
Posts: 5228
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: Underscores vs CamelCase

Postby Xanthir » Sat Mar 19, 2016 3:15 pm UTC

(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
chridd
Has a vermicelli title
Posts: 779
Joined: Tue Aug 19, 2008 10:07 am UTC
Location: ...Earth, I guess?
Contact:

Re: Underscores vs CamelCase

Postby chridd » Sat Mar 19, 2016 4:30 pm UTC

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).
~ chri d. d. /tʃɹɪ.di.di/ (Phonotactics, schmphonotactics) · they (for now, at least) · Forum game scores
mittfh wrote:I wish this post was very quotable...
flicky1991 wrote:In both cases the quote is "I'm being quoted too much!"

commodorejohn
Posts: 965
Joined: Thu Dec 10, 2009 6:21 pm UTC
Location: Placerville, CA
Contact:

Re: Underscores vs CamelCase

Postby commodorejohn » Sun Mar 20, 2016 7:01 am UTC

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.
"'Legacy code' often differs from its suggested alternative by actually working and scaling."
- Bjarne Stroustrup
www.commodorejohn.com - in case you were wondering, which you probably weren't.

User avatar
You, sir, name?
Posts: 6974
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Underscores vs CamelCase

Postby You, sir, name? » Fri Apr 01, 2016 9:40 pm UTC

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.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

commodorejohn
Posts: 965
Joined: Thu Dec 10, 2009 6:21 pm UTC
Location: Placerville, CA
Contact:

Re: Underscores vs CamelCase

Postby commodorejohn » Sun Apr 03, 2016 3:20 pm UTC

That's how you tell that it's C++ written by someone who'd really rather be using Java.
"'Legacy code' often differs from its suggested alternative by actually working and scaling."
- Bjarne Stroustrup
www.commodorejohn.com - in case you were wondering, which you probably weren't.

User avatar
You, sir, name?
Posts: 6974
Joined: Sun Apr 22, 2007 10:07 am UTC
Location: Chako Paul City
Contact:

Re: Underscores vs CamelCase

Postby You, sir, name? » Sun Apr 03, 2016 4:34 pm UTC

I've never seen anyone do it in Java. I don't understand where it's coming from.
I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

User avatar
Xenomortis
Not actually a special flower.
Posts: 1397
Joined: Thu Oct 11, 2012 8:47 am UTC

Re: Underscores vs CamelCase

Postby Xenomortis » Mon Apr 04, 2016 8:30 am UTC

C# does that.
As does the entire Win32 API?
Image

User avatar
ConMan
Shepherd's Pie?
Posts: 1632
Joined: Tue Jan 01, 2008 11:56 am UTC
Location: Beacon Alpha

Re: Underscores vs CamelCase

Postby ConMan » Wed Apr 06, 2016 5:59 am UTC

If you regularly code in R, then you separate words with periods, to make.other.programmers.cry
pollywog wrote:
Wikihow wrote:* Smile a lot! Give a gay girl a knowing "Hey, I'm a lesbian too!" smile.
I want to learn this smile, perfect it, and then go around smiling at lesbians and freaking them out.

User avatar
heuristically_alone
Posts: 169
Joined: Sat Apr 09, 2016 7:43 pm UTC
Location: 37.2368078 and -115.80341870000001

Re: Underscores vs CamelCase

Postby heuristically_alone » Sun Apr 10, 2016 3:24 am UTC

I, like Robert_Frost, prefer to take the road less taken, and that indeed has made all the difference.
Bow gifted by adnapemit.

Beatrice wrote:The world is quiet here.

Tillian wrote:sig'd

Derek
Posts: 2155
Joined: Wed Aug 18, 2010 4:15 am UTC

Re: Underscores vs CamelCase

Postby Derek » Tue Apr 12, 2016 10:47 pm UTC

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.

User avatar
stopmadnessnow
Posts: 83
Joined: Thu Mar 03, 2016 10:58 pm UTC
Location: Somewhere in that country with Big Ben in it.

Re: Underscores vs CamelCase

Postby stopmadnessnow » Wed Apr 13, 2016 8:31 pm UTC

No Derek, because it's only one fork in the road. It's not necessarily an attitude problem that heuristically_alone has.
For comic writing or short story writing post-haste, contact the off-the peg joke chap. He has the nous.
http://plwimsett.simplesite.com/ for my site.
https://www.upwork.com/freelancers/~01110048bacb43eae6 to hire me at Upwork.

Derek
Posts: 2155
Joined: Wed Aug 18, 2010 4:15 am UTC

Re: Underscores vs CamelCase

Postby Derek » Wed Apr 20, 2016 10:05 am UTC

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!

SuicideJunkie
Posts: 157
Joined: Sun Feb 22, 2015 2:40 pm UTC

Re: Underscores vs CamelCase

Postby SuicideJunkie » Thu Oct 05, 2017 6:59 pm UTC

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.


Return to “Religious Wars”

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests