Camel case


Camel case is a writing format practice of writing phrases without spaces or punctuation and with capitalized words. The practice has various name and conventions. The earliest known occurrence of the term InterCaps on Usenet was in April 1990.
The use of medial capitals as a convention in the regular spelling of everyday texts is rare, but is used in some languages as a solution to particular problems which arise when two words or segments are combined. In the scholarly transliteration of languages written in other scripts, medial capitals are used in similar situations. Medial capitals are traditionally used in abbreviations to reflect the capitalization that the words would have when written out in full, for example in the academic titles PhD or BSc.
The first systematic and widespread use of medial capitals for technical purposes was the notation for chemical formulas invented by the Swedish chemist Jacob Berzelius in 1813. Since the early 20th century, medial capitals have occasionally been used for corporate names and product trademarks. In the 1970s and 1980s, medial capitals were adopted as a standard or alternative naming convention for multi-word identifiers in several programming languages. The use of medial caps for compound identifiers is recommended by the coding style guidelines of many organizations or software projects. Camel case has been criticized as negatively impacting readability due to the removal of spaces and uppercasing of every word.

Description

The writing format camel case is the practice of writing phrases without spaces or punctuation and with capitalized words. The format indicates the first word starting with either case, then the following words having an initial uppercase letter. Common examples include YouTube, PowerPoint, HarperCollins, FedEx, iPhone, eBay, and LaGuardia. Camel case is often used as a naming convention in computer programming. It is also sometimes used in online usernames such as JohnSmith, and to make multi-word domain names more legible, for example in promoting EasyWidgetCompany.com.
The more specific terms Pascal case and upper camel case refer to a joined phrase where the first letter of each word is capitalized, including the initial letter of the first word. Similarly, lower camel case requires an initial lowercase letter. Some people and organizations, notably Microsoft, use the term camel case only for lower camel case, designating the upper camel case separately as Pascal case. Some programming styles prefer camel case with the first letter capitalized, others not. For clarity, this article leaves the definition of camel case ambiguous with respect to capitalization of the first word, and uses the more specific terms when necessary.
Camel case is distinct from several other styles: title case, which capitalizes all words but retains the spaces between them; Tall Man lettering, which uses capitals to emphasize the differences between similar-looking product names such as predniSONE and predniSOLONE; and snake case, which uses underscores interspersed with lowercase letters. A combination of snake and camel case is recommended in the Ada 95 style guide.

Variations and synonyms

The practice has various names, including:
  • camelBack notation or CamelCaps
  • camel case or CamelCase
  • CapitalizedWords or CapWords for upper camel case in Python
  • compoundNames
  • Embedded caps
  • HumpBack notation
  • InterCaps or intercapping
  • medial capitals, recommended by the Oxford English Dictionary
  • mixedCase for lower camel case in Python
  • PascalCase for upper camel case
  • Smalltalk case
  • WikiWord or WikiCase

    History

The earliest known occurrence of the term InterCaps on Usenet is in an April 1990 post to the group alt.folklore.computers by Avi Rappoport. The earliest use of the name "Camel Case" occurs in 1995, in a post by Newton Love. Love has since said, "With the advent of programming languages having these sorts of constructs, the humpiness of the style made me call it HumpyCase at first, before I settled on CamelCase. I had been calling it CamelCase for years.... The citation above was just the first time I had used the name on USENET." The term "Pascal Case" was coined in design discussions for the.NET Framework, first released in 2002.

Traditional use in natural language

In word combinations

The use of medial capitals as a convention in the regular spelling of everyday texts is rare, but is used in some languages as a solution to particular problems which arise when two words or segments are combined.
In Italian, pronouns can be suffixed to verbs, and because the honorific form of second-person pronouns is capitalized, this can produce a sentence like non ho trovato il tempo di risponderLe.
In German, many nouns denoting people lack a gender-neutral form, which is why often, especially colloquially, the male form of a noun is used generically to address everyone, regardless of their gender. Another, more recent approach is using the medial capital letter I, called Binnen-I, in written text for words like StudentInnen to indicate that both Studenten and Studentinnen are referred to simultaneously. However, mid-word capitalization does not conform to the German orthography prescribed by the Rat für deutsche Rechtschreibung apart from proper names like McDonald. In order to adhere to orthography, the introductory "students" example could be corrected using parentheses to Studenten, which is analogous to writing "congressmen" in English.
In Irish, camel case is used when an inflectional prefix is attached to a proper noun, for example i nGaillimh, from Gaillimh ; an tAlbanach, from Albanach ; and go hÉirinn, from Éire. In recent Scottish Gaelic orthography, a hyphen has been inserted: an t-Albannach.
This convention of inflectional prefix is also used by several written Bantu languages and several indigenous languages of Mexico.
In Dutch, when capitalizing the digraph ij, both the letter I and the letter J are capitalized, for example in the country name IJsland.
In Chinese pinyin, camel case is sometimes used for place names so that readers can more easily pick out the different parts of the name. For example, places like Beijing, Qinhuangdao, and Daxing'anling can be written as BeiJing, QinHuangDao, and DaXingAnLing respectively, with the number of capital letters equaling the number of Chinese characters. Writing word compounds only by the initial letter of each character is also acceptable in some cases, so Beijing can be written as BJ, Qinghuangdao as QHD, and Daxing'anling as DXAL.
In English, medial capitals are usually only found in Scottish or Irish "Mac-" or "Mc-" patronymic names, where for example MacDonald, McDonald, and Macdonald are common spelling variants of MacDonald, and in Anglo-Norman "Fitz-" names, where for example both FitzGerald and Fitzgerald are found.
In their English style guide The King's English, first published in 1906, H. W. and F. G. Fowler suggested that medial capitals could be used in triple compound words where hyphens would cause ambiguity—the examples they give are KingMark-like and Anglo-SouthAmerican. However, they described the system as "too hopelessly contrary to use at present".
Some French names also uses CamelCase names, such as LeBeau, LaRue, DeMordaunt, and Italian names DeRose/DeRosa.

In transliterations

In the scholarly transliteration of languages written in other scripts, medial capitals are used in similar situations. For example, in transliterated Hebrew, haIvri means "the Hebrew person" or "the Jew" and b'Yerushalayim means "in Jerusalem". In Tibetan proper names like rLobsang, the "r" stands for a prefix glyph in the original script that functions as tone marker rather than a normal letter. Another example is tsIurku, a Latin transcription of the Chechen term for the capping stone of the characteristic Medieval defensive towers of Chechnya and Ingushetia; the letter "I" is not actually capital, denoting a phoneme distinct from the one transcribed as "i".

In abbreviations

Medial capitals are traditionally used in abbreviations to reflect the capitalization that the words would have when written out in full, for example in the academic titles PhD or BSc. A more recent example is NaNoWriMo, a contraction of National Novel Writing Month and the designation for both the annual event and the nonprofit organization that runs it. In German, the names of statutes are abbreviated using embedded capitals, e.g. StGB for Strafgesetzbuch, PatG for Patentgesetz, BVerfG for Bundesverfassungsgericht, or the very common GmbH, for Gesellschaft mit beschränkter Haftung. In this context, there can even be three or more camel case capitals, e.g. in TzBfG for Teilzeit- und Befristungsgesetz. In French, camel case acronyms such as OuLiPo were favored for a time as alternatives to initialisms.
Camel case is often used to transliterate initialisms into alphabets where two letters may be required to represent a single character of the original alphabet, e.g., DShK from Cyrillic ДШК.

History of modern technical use

Chemical formulas

The first systematic and widespread use of medial capitals for technical purposes was the notation for chemical formulas invented by the Swedish chemist Jacob Berzelius in 1813. To replace the multitude of naming and symbol conventions used by chemists until that time, he proposed to indicate each chemical element by a symbol of one or two letters, the first one being capitalized. The capitalization allowed formulas like "NaCl" to be written without spaces and still be parsed without ambiguity.
Berzelius' system continues to be used, augmented with three-letter symbols such as "Uue" for unconfirmed or unknown elements and abbreviations for some common substituents. This has been further extended to describe the amino acid sequences of proteins and other similar domains.