29

Was looking through some code today, and found something that highlights my biggest struggles in programming, it's compound words and casing. Had identifiers such as...

strikeThroughOffset
whitespaceWidth
lineSpacing
underlineOffset
outlineThickness

I can keep in mind "strike through off set", but then I struggle to remember, is it strikethrough or strikeThrough? What about Offset or OffSet? Why are offset, underline, and outline, all one word, but strikeThrough isn't? I think of it as one compound word, many people apparently do, but I guess someone who wrote this code doesn't.

Or... is this just a me problem? Does anyone else struggle with this sort of thing? Am I missing something or should I "just get good"? My best solution so far is just keep everything always lowercase, personally I find that more readable and memorable, but that's a lot to ask of literally every other programmer in the world...

you are viewing a single comment's thread
view the rest of the comments
[-] MagicShel@programming.dev 9 points 1 year ago

It doesn't really matter all that much. camelCase is to break up the long variable names and help people find the word breaks. Like imagine linespacing. That could be line spacing or lines pacing, and a little context would help you understand which (yeah this is a bit of a stretch)

As long as it helps clarify, it doesn't matter. That doesn't mean it won't bug me if I think someone has done it wrong, but it doesn't really matter.

this post was submitted on 07 Aug 2023
29 points (100.0% liked)

Programming

13269 readers
11 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