CamelCase

Does this look like a brand name for a company that makes packing cases, either for camels or somehow purporting to have camel-like qualities? That’s because CamelCase (also called camelCase and camel case) is often used in branding – indeed, ordinary non-tech-geek people seldom have any reason to encounter it in anything else.

CamelCase is one of those nice words (like hiss) that exemplify what they name. (So is camelCase, but camel case is not). What it refers to is the practice of putting capitals in the middle of a word – or, most typically, in the middle of a concatenation of words, to make it easier to see where one word ends and another starts in the conglomeration. (CamelCase capitalizes at word or morpheme beginnings; random or quasi-random capitalization, lIkE tHis soRt Of ThinG, is called studlycaps.)

The reasons for even needing camelCase come down to one: theNecessityOrDesirabilityOfLeavingOutSpaces. There are circumstances where spaces are inconvenient or simply unavailable. In brand names, a phrase of common words may not be trademarkable, whereas a concatenation may be (e.g., MasterCard, WordPerfect). In much computer coding, a space separates terms, so if you want to name a variable or similar entity with a phrase, you have to do so without spaces. (Back when you only had CAPITAL LETTERS on computers – until the early-mid ’80s – camelCase wasn’t even an option.) The same goes for things such as hashtags. In fact, I was reminded of camelCase yesterday when I saw this tweet from @benjyraymunson:

You’d think that the whole #nowthatcherisdead hulalbaloo would lead to a discussion of parsing ambiguity & the importance of CamelCase

Indeed. Context tells us that the hashtag should be parsed as #nowThatcherIsDead, but an uninformed reader could take it as #nowThatCherIsDead. CamelCase could also help some rather unfortunate website URLs, such as penisland.com (should be PenIsland.com) and speedofart.com (meant to be SpeedOfArt.com, nothing to do with bathing suits and flatulence) – although for very good reasons URLs are not case-sensitive, so you can’t keep your camels humpy.

There is another condition in which camelCase is often seen: syllable acronyms – words made of the first syllables of other words. These used to be more popular, but letter acronyms (made with just the initials) have taken over now. They can still be seen in place names, and CamelCase survives variously in them – it often wears down to standard capitalization: SoWeTo, from South West Township, now often Soweto; SoHo, from South of Houston (in New York; Houston Street is at the bottom of the numbered streets), now often Soho; and so on. It arose naturally enough in this context because these names have become single words but they bear the traces of their clipped proper nouns. It can also be argued that CamelCase is also used in chemical formulae, e.g., NaCl, but those are not pronounced as written (NaCl is said as “sodium chloride”), so it’s a different case.

An alternative to camelCase, not available in all contexts but popular in file names, is snake case, or should I write snake_case: spaces are replaced with underscores. This is clearer but requires more characters, and the underscore is a minor nuisance to type. (Hyphens in place of underscores can be used in some places but not in others.)

I just assume it is clear why camelCase is called what it is: a word thus capitalized has humps like a camel. The term was apparently invented by Newton Love, a computer programmer; the first citation for it is from 1995, although he came up with it some time before that. The practice therefore predates the name considerably; the older way of naming it is medial capitals or any similar descriptive term. There are two types: upper CamelCase, wherein the first letter is also capped, and lower camelCase, wherein the first letter is not capped. I’m tempted to call these Bactrian and dromedary, respectively, but no one else does, and anyway, there’s often more than one medial hump per word.

One response to “CamelCase

  1. I remember the writers on M*A*S*H having fun with syllable acronyms. I just wish could remember what they were!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s