6 ms·
Good to see some scientific studies on the easier_readability_of_snake_case, versusComparedToCamelCaseBouncingUpAndDown. I tried to convince my co-workers toTr
by inDigiNeous 4y ago
Good to see some scientific studies on the easier_readability_of_snake_case, versusComparedToCamelCaseBouncingUpAndDown.
I tried to convince my co-workers toTransitionFromCamelCase to the world_of_easy_reading_snake_case, but alas, the codebase alreadyUsingCamelCase won.
Maybe it's the idea that "shorter == better", or whatever, but if I could choose, I would use snake_case_everywhere man.
- brookst 4y agoI am pro-snake myself, but those that use double underscores, especially in a meaningful way, are drilling holes in our boat.
- spookthesunset 4y agoWhat is a double underscore? hello__world?
- jayknight 4y agoYep, or "dunder" as it's often called in the python world.
- eddsh1994 4y ago__special_functions__ __privateish_variable Etc, in the land of Python
- goodoldneon 4y agoI wish Python enforced private attributes. I once worked in a codebase where this was roughly true: _usually_private_but_ok_to_access_if_you_are_knowledgeable __private_unless_you_need_an_escape_hatch ___absolutely_private_except_for_a_few_times
- brookst 4y agoI mean doesn’t it make you want to make ___________super_ultra_private, with an accessor that corrupts the filesystem and hangs if you so much as look at it?
- goodoldneon 4y agoThat sounds good, but we might need a class attribute that disables filesystem corruption in case we need to access `___________super_ultra_private` somewhere
- stnmtn 4y agoI don't hate leading underscores on _private_function or _class variable, in fact I think it's a great way to semantically signal intent The double underscore for __super_private_function doesn't make much sense to me though. I can't see a reason why this shouldn't just be a single underscore, especially when __double_underscore__ signals very important python internals
- clawlor 4y agoThe leading double underscore functions differently from a leading single underscore in this case: > Any identifier of the form __spam (at least two leading underscores, at most one trailing underscore) is textually replaced with _classname__spam, where classname is the current class name with leading underscore(s) stripped. See https://docs.python.org/3/tutorial/classes.html#private-variables https://docs.python.org/3/tutorial/classes.html#private-vari...
- taeric 4y agoI do find your straw man for the camel case amusing. Specifically, "versus compared to" doesn't parse well and hurts my ability to read it. That said, data in this study is interesting for being data and a replication. I don't know that I've given much thought to liking one style over the other in a long time, neat to see the impact it can have. Directly to your last point, I do greatly prefer single word names, if they can be used. So, `candidates` over `candidateList` or `candidate_list`.
- deleted 4y ago[deleted]
- stevula 4y agoI do prefer snakecase visually but having to press shift for the underscore is a pain and it’s also quite far from the home row on the keyboard. I wonder if a lot of people rebind the underscore character to a more convenient key?
- simonblack 4y agobut having to press shift for the underscore is a pain But having to press shift for a capitalised word is not a pain. OK, sounds about right.
- stevula 4y agoHa! You got me there.
- irrational 4y agoFor me it is easier/faster to type uppercase letters than an underscore. But, I have small hands.
- kitsunesoba 4y agoSame. I'm noticeably faster with camelCase.
- timbit42 4y agoThat's why kebab-case-is-best.
- inDigiNeous 4y agoWell, this-case-has-the-problem-of-mixing-with-the-letters-more-easily. When you type snake_case it is clearly not in the line of the letters. But yeah kebab-case-might-be-easier than camelCaseToRead in the long run.
- shrimp_emoji 4y agoThis haunts me. It seems almost as good as snek_case but doesn't require a Shift. If we're not Shifting the letters, why are we shifting the -s? My OCD. (Or my autism?) Help. Another consideration: whether the program you're typing in will stop at underscores or hyphens when using Ctrl + Shift + Left/Right Arrow when highlighting. If I want to highlight `this_variable_with_a_long_name` without using the mouse, it's going to be a pain if I have to hit the left arrow key six times instead of once. (Frustratingly, it varies from editor to editor.)
- nashashmi 4y agoDefinitely shorter is better especially when the names are incredibly long. Also helps in narrow word wrapped screens.
- wvenable 4y agoI wonder if novelty matters. This "versusComparedToCamelCaseBouncingUpAndDown" is certainly harder to read but I also found it harder to read than all my CamelCase identifiers in code. For me OriginalAmount or AdjustmentFees are just one word each.