Acronyms in CamelCase [closed]

There are legitimate criticisms of the Microsoft advice from the accepted answer.

  • Inconsistent treatment of acronyms/initialisms depending on number of characters:
  • playerID vs playerId vs playerIdentifier.
  • The question of whether two-letter acronyms should still be capitalized if they appear at the start of the identifier:
  • USTaxes vs usTaxes
  • Difficulty in distinguishing multiple acronyms:
  • i.e. USID vs usId (or parseDBMXML in Wikipedia’s example).

So I’ll post this answer as an alternative to accepted answer. All acronyms should be treated consistently; acronyms should be treated like any other word. Quoting Wikipedia:

…some programmers prefer to treat abbreviations as if they were lower case words…

So re: OP’s question, I agree with accepted answer; this is correct: getUnescoProperties()

But I think I’d reach a different conclusion in these examples:

  • US TaxesusTaxes
  • Player IDplayerId

So vote for this answer if you think two-letter acronyms should be treated like other acronyms.

Camel Case is a convention, not a specification. So I guess popular opinion rules.

( EDIT: Removing this suggestion that votes should decide this issue; as @Brian David says; Stack Overflow is not a “popularity contest”, and this question was closed as “opinion based”)

Even though many prefer to treat acronyms like any-other word, the more common practice may be to put acronyms in all-caps (even though it leads to “abominations”)

Other Resources:

  • Note some people distinguish between abbreviation and acronyms
  • Note Microsoft guidelines distinguish between two-character acronyms, and “acronyms more than two characters long”
  • Note some people recommend to avoid abbreviations / acronyms altogether
  • Note some people recommend to avoid camelCase / PascalCase altogether
  • Note some people distinguish between “consistency” as “rules that seem internally inconsistent” (i.e. treating two-character acronyms different than three-character acronyms); some people define “consistency” as “applying the same rule consistently” (even if the rule is internally inconsistent)
  • Framework Design Guidelines
  • Microsoft Guidelines

Leave a Comment