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…

@delial@lemmy.sdf.org
link
fedilink
English
71Y

Yeah, this is one of those constant annoyances that you kinda just live with. It doesn’t matter that much, because compound words were at some point not one word, and there may be separate words that you use today that will join together during your career. Electronic mail became e-mail became email. As long as the casing doesn’t hide the meaning, you’re doing it right. Also be consistent. Don’t recreate such monstrosities as XMLHttpRequest.

Create a post

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.

  • 1 user online
  • 7 users / day
  • 7 users / week
  • 14 users / month
  • 121 users / 6 months
  • 1 subscriber
  • 296 Posts
  • 2.15K Comments
  • Modlog