Live data from Hacker News

CamelCase vs underscores: Scientific showdown (2011)

whatheco.de

11–20 of 138 posts

Re: CamelCase vs underscores: Scientific showdown (2011)

#15
post #12

Why can't we just have spaces in our variable names? These are both work arounds.

So that the compiler or interpreter knows the extent of the variable token. Without spaces allowed you would need some other way to tell it where they start and end, like quotes or a special declaration, which would be harder for the brain to parse. If you know a better way please share it.

Re: CamelCase vs underscores: Scientific showdown (2011)

#16
With an azerty keyboard, underscores are a single stroke of the "8" key. This nullifies the "underscores are hard to type" argument. I'd even wager that the performance results are inverted in my country since snake_case does not require any press of the shift key, unlike camelCase. Also, I'm pretty sure I read a study one time that showed snake_case identifiers to be easier to read than camelCase ones.

Anyways, I think you should follow the specific guidelines of the language you are currently using.

Re: CamelCase vs underscores: Scientific showdown (2011)

#17
post #9

I find snake case so much easier to read, breathing space between words is there for a reason.

IAgreeThatSnakeCaseIsEasierToRead,ThoughIfWeWereToUseCamelCaseMoreWeWouldBeSavingAGoodAmountOfSpace,WhichMightBeUsefulForNarrowBlocksOfText.I'mSuprisedItHasn'tCaughtOnInProse.Actually,LookingAtThis,MaybeIt'sAGoodThingItHasn'tCaughtOnForProse.

Re: CamelCase vs underscores: Scientific showdown (2011)

#20
I got the solution! Given that spaces in identifiers cannot be used because we need to please the language tokenizers (shouldn't be the other way around with humans vs machines?), let's use TAB as a word separator!

Configure TAB width = 1 character, and there you go.

Post reply on HN