Live data from Hacker News

CamelCase vs underscores: Scientific showdown (2011)

whatheco.de

101–110 of 138 posts

Re: CamelCase vs underscores: Scientific showdown (2011)

#101
post #99

IMO, with underscores it is not immediate recognizing the elements of an expression like some_var.some_fun(some_param, another_param) Instead with CamelCase, they are immediately visible: someVar.someFun(someParam, anotherParam) But my preferred syntax is Lisp: (some-fun some-var some-param another-param) (when this-looks-appealing (setf you-like-lisp-syntax true) (vote-poll 'camel-case-formatting)) IMO, "this-looks-…

That works for lisp but it's awkward for languages with infix subtraction.

Re: CamelCase vs underscores: Scientific showdown (2011)

#103
post #21

Earlier quoted context omitted.

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

Classical Latin used all caps no spaces, so rather than caught on we moved away from it. https://en.wikipedia.org/wiki/Scriptio_continua

My favorite deprecated writing convention is boustrophedon: https://en.m.wikipedia.org/wiki/Boustrophedon

Re: CamelCase vs underscores: Scientific showdown (2011)

#104
post #21

Earlier quoted context omitted.

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

Classical Latin used all caps no spaces, so rather than caught on we moved away from it. https://en.wikipedia.org/wiki/Scriptio_continua

Japanese also doesn't have casing or spaces, which can make text written solely in hiragana (like some Famicom games) hard to read. I don't know enough about Chinese and Korean to opine on how difficult they are to read and comprehend, but by using the four writing systems (hiragana, katakana, kanji, and western script), Japanese is easy enough to read.

Re: CamelCase vs underscores: Scientific showdown (2011)

#105

This misses one advantage of underscores, which is consistency: foo modified_foo foo modifiedFoo With underscores, "foo" looks the same whether it stands alone or not.

In that example foo is the important aspect, so it should be the leading element:

  foo
  fooModified

Re: CamelCase vs underscores: Scientific showdown (2011)

#106
post #99

IMO, with underscores it is not immediate recognizing the elements of an expression like some_var.some_fun(some_param, another_param) Instead with CamelCase, they are immediately visible: someVar.someFun(someParam, anotherParam) But my preferred syntax is Lisp: (some-fun some-var some-param another-param) (when this-looks-appealing (setf you-like-lisp-syntax true) (vote-poll 'camel-case-formatting)) IMO, "this-looks-…

That works for lisp but it's awkward for languages with infix subtraction.

yes, sure. Also

  some-var.some-fun(some-param, another-param)
the "-" hides the ".", but it should be the contrary, because "." is a stronger separator.

Re: CamelCase vs underscores: Scientific showdown (2011)

#107
post #12

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

Even in languages where you can have spaces, only jerks do that. Do you really want to type [Some stupid variable name].[some Stupid function]?

These are false time savers. We’re writing code, just recognize that and do what’s natural, snake_case. Any conventions to make code “more readable” to make it like written language seem like fool’s errands to me.

Re: CamelCase vs underscores: Scientific showdown (2011)

#108
post #89
post #52

Earlier quoted context omitted.

Behold this monstrosity: devDbUrl Madness. The only thing worse that developers willingly tolerate is prettier's sacrilegious linebreaks [0]. 0: https://prettier.io/playground/#N4Igxg9gdgLgprEAuc0DOMAEBXNc...

JFC preach! This shits me to tears, I need to figure out a way to turn those line breaks off.

The best solution I've found is to not use Prettier and instead use ESLint Stylistic for formatting:

https://eslint.style/guide/why

Re: CamelCase vs underscores: Scientific showdown (2011)

#109
post #9

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

I agree; I have done a full 180 from preferring camelcase to using snake case everywhere. It simplifies parsing for my old eyes.

I also got unnaturally irritated by PowerShell's insistence on hewing so closely to CamelCaseOrthodoxy that common abbreviations and acronyms like ID, IP, and DB became Id, Ip, Db.

Left to my own devices, I'll use OTBS + lower_snake and it drives some of The Youths on my team insane.

Re: CamelCase vs underscores: Scientific showdown (2011)

#110
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.

On_the_other_hand,_is_snake_case_really_that_much_better_for_reading_prose?_I_find_this_difficult_to_read_as_well._Also,_at_least_part_of_the_reason_camel_case_prose_is_more_difficult_to_read_is_because_the_beginnings_of_sentences_are_no_longer_uniquely_capitalized,_which_isn't_an_issue_in_code.
Post reply on HN