this post was submitted on 07 Aug 2023
29 points (100.0% liked)
Programming
13376 readers
1 users here now
All things programming and coding related. Subcommunity of Technology.
This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
What an interesting problem!
Are you able to use other styles of casing? Like underscore casing might help because you can see the spaces so it's strike_through_offset Whitespace_width Etc Or maybe, if you have to stick with camel, it's every syllable (if you work on a team, I would not recommend this, but for personal stuff it should be fine)
I don't think it's a case of get good so much as it is a case of you parsing things differently depending on brain state, and you not having a tool to help you over come it/return to the previous brain state that could tell you which letter to capitalize.
I think your best bet might be to come up with hard arbitrary rules and practice those until it sticks. It's all vibes until experience hardens it into an opinion, basically
My initial kneejerk reaction though was "you're thinking too hard about it, just let it flow" but idk if that's helpful in the slightest lol certainly wouldn't help if there's a mental bump at play, so I think simplifying the rules into something regular is probably the best place to start
Hmm per-syllable camel case, is that a thing? Sounds interesting! I might like that one lol
But yeah, am I able to use another casing style... the thing is, kinda yes? But kinda no. I think I basically can manage any style (Though not a fan of the underscore_style but hey, can do), it's really just compound words that trip me up. Like, consider white space width and strike through off set. I can keep every word in mind, but apparently whitespace is one word, and strike through might be two words, depending on who you ask. So to me, I think this is correct:
whitespace_width
,strikethrough_offset
But someone else might think it should be:
white_space_width
,strike_through_off_set
And yet a third person might do:
whitespace_width
,strike_through_offset
I just can't memorize which words are compound words, and which ones aren't, and I don't know how to tell without just knowing. I know what words go into identifier names, but when some of those words might be compound words, I get all messed up, which is a bit of an issue when working with other people's code.
Maybe in a way, my problem is that I memorize the names of things in a sort of "spoken" state; I "say" strike through off set in my mind, but capitalization doesn't affect speech, so if its 'strikethroughoffset' or 'StrikeThroughOffSet", my brain is gonna memorize it as just the 4 words, "strike through off set".
So in the end, the easiest thing I've found when working on my own projects is just keep everything lowercase, no underscores. The tiniest exception I might make is a singleton, but generally I think "If I have a collection of data and functions, and there will only be 1 instance of it, there's a name for that: A namespace" so I don't often employ those. (Maybe you can tell I have C/C++ in mind especially lol)