Hey, it’s not a bad name for it. He actually kind of looks like flatMap, at a glance.

camelCasing acronyms — no single good solution. Or is there?

Frank Sandqvist
Smidyo Codex
Published in
2 min readApr 23, 2018

--

Semantics is one of those completely unwarranted tiny things to waste a good hour on, re-re-re-re-factoring my code (albeit with find and replace).

“Hmm, xmlToJSON. That seems logical. Acronyms are not a word.”

…a good half day later…

“You know what? I don’t like these unbalanced function names! They start low and end HIGH. Looks stupid. Let me change it to xmlToJson”

Even worse that it begins with an acronym. I should really name it xMLToJSON, shouldn’t I? Bow down to logic. But you’d have to look around quite a while to find someone who finds that versal-soup good looking.

So I asked around on Twitter. The majority went all Pascal-case on me. All caps. No matter if it’s in the beginning or the end! XMLToJSON! This isn’t a class! No way José, I’m not going down that route.

Perhaps the logical solution would be going all snake_case. Ditch the shift key all-together! xml_to_json. Kind of sounds like a Counter Strike map though — Not a fan. Looks old-school.

Screw it. All my code will be Emojis from now on. Oh. You can’t run Emojicode. Darn.

So I’m back to treating acronyms as words. xmlToJson it is. After many wasted CMD+R’s — this is the system I’ve chosen. Feel free to object off in the comments!

--

--