Naming with abbreviations is tricky. Assume you want a class named after "GNU" and "GPL". How are you supposed to capitalize it?
I would go for "GnuGplClass", but W3C uses "GNUGplClass" format. ("XMLHttpRequest")
Airbnb should have a preference here and rules 22.2 and 22.3 should be extended accordingly.
imo acronyms and initialisms should always be all capitalized, or all lowercased - there's no benefit in making things less readable to satisfy an outdated camelCasing algorithm.
It definitely gets tricky with doubled initialisms, like "XML" and "HTTP", or "GNU" and "GPL". However, typically there, the solution is to use a better name. Since I don't know the use case of your "GNU + GPL" thing, I'll use XMLHttpRequest - clearly "httpRequest" would be both a more accurate and less tricky name for a thing that is rarely used with XML :-)
In other words, when a desired name would force one to do something awkward with capitalization, my advice is to rethink that name.
I like the suggestion to use initial caps whenever an acronym is used--e.g., XmlHttpRequest or GnuGplClass. It's what I've used for years. It works out nicely.
I like the suggestion to use initial caps whenever an acronym is used--e.g., XmlHttpRequest or GnuGplClass. It's what I've used for years. It works out nicely.
That's also what I've been using, but I started to question the style after I realized W3C does it differently.
The name of XMLHttpRequest is a legacy from its original creation in IE, and isn't reflective of the W3C's naming conventions.
What does W3C use now?
http://www.w3.org/2005/rules/wg/wiki/Arch/Naming_Conventions.html looks to be their conventions. However, I wouldn't look to the W3C for best practices regarding naming conventions :-)
Then should I use XMLHTTPRequest since there is no rule for doubled initialisms?
there's this:
- 23.9 Acronyms and initialisms should always be all capitalized, or all lowercased.
This seems answered.
Most helpful comment
there's this: