CamelCase

CamelCase (or camel case), also known as medial capitals,[1] is the practice of writing compound words or phrases in which the elements are joined without spaces, with each element's initial letter capitalized within the compound and the first letter either upper or lower case—as in "LaBelle", "BackColor", "McDonald's", "iPod", or "GaGa". The name comes from the uppercase "bumps" in the middle of the compound word, suggestive of the humps of a camel. The practice is known by many other names.

An early systematic use of medial capitals is the standard notation for chemical formulae, such as NaCl, that has been widely used since the 19th century. In the 1970s, medial capitals became an alternative (and often standard) identifier naming convention for several programming languages. Since the 1980s, following the popularization of computer technology, it has become fashionable in marketing for names of products and companies, and for 1990s online video games where players use pseudonyms (when spaces were not allowed). However, medial capitals are rarely used in formal written English and most style guides recommend against their use.

Contents

Variations and synonyms

The first letter of a camel case compound may or may not be capitalized. For clarity, this article calls the two alternatives upper camel case and lower camel case. Some people and organizations use the term camel case only for lower camel case. Other synonyms include:

  • BumpyCaps[2] or BumpyCase[citation needed]
  • camelBack (or camel-back) notation[3]
  • CamelCaps[4]
  • CapitalizedWords or CapWords for upper camel case in Python[5]
  • compoundNames[6]
  • Embedded Caps (or Embedded Capitals)[7]
  • HumpBack (or hump-back) notation[8]
  • InterCaps or intercapping[9] (abbreviation of Internal Capitalization[10])
  • mixedCase for lower camel case in Python[5]
  • nerdCaps[2] or headlessCamelCase
  • Pascal case for upper camel case[11][12][13]
  • Smalltalk case
  • WikiWord[14] or WikiCase[15] (especially in older wikis)

StudlyCaps style is similar (but not necessarily identical) to camel case.[2] It is sometimes used in reference to camel case but can also refer to random mixed capitalization (as in "MiXeD CaPitALiZaTioN"), popularly used in online culture.

Camel case is also distinct from title case, which is traditionally used for book titles and headlines. Title case capitalizes most of the words yet retains the spaces between the words.[16][17][18]

Camel case is also distinct from Tall Man lettering, which uses capitals to emphasize the differences between similar-looking words.

History

Early uses in personal names

Medial capitals have always been used (albeit sporadically) in English, for example, as a traditional spelling style for certain surnames, such as in Scottish MacLean (originally, "son of Gillean") and Hiberno-Norman FitzGerald ("son of Gerald"). This same convention is sometimes used in English for surnames of foreign origin which include prepositions or other particles, e.g., DuPont (from French Dupont or du Pont), DiCaprio (from Italian di Caprio) and VanDyke (from Dutch van Dijk). The actress ZaSu Pitts, whose fame peaked in the 1930s and 1940s, sometimes spelled her given name in camel case, emphasizing its derivation from two other names.

Chemical formulae

The first systematic and widespread use of medial capitals for technical purposes was the notation for chemical formulae invented by the Swedish chemist 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 formulae like 'NaCl' to be written without spaces and still be parsed without ambiguity.[19][20]

Berzelius's system remains in use to this day, augmented with three-letter symbols like 'Uuq' for unnamed elements; and has been extended to describe the aminoacid sequences of proteins and other similar domains. Internal capitalization has also been used for other technical codes like HeLa (1983).

The King's English

In their English style guide The King's English, first published in 1906, H. W. Fowler 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" (as against "King Mark-like") and "Anglo-SouthAmerican" (as against "Anglo-South American"). However, they described the system as "too hopelessly contrary to usage at present."[21]

Early use in trademarks

Since the mid-20th century, medial capitals have occasionally been used for corporate names and product trademarks, such as

Computer programming

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 origin of this convention has not yet been settled. However a 1954 conference proceedings[23] informally referred to IBM's Speedcoding system as "SpeedCo". Christopher Strachey's paper on GPM (1965),[24] shows a program that includes some medial capital identifiers, including "NextCh" and "WriteSymbol".

Background: multi-word identifiers

Computer programmers often need to write descriptive (hence multi-word) identifiers, like "end of file" or "char table", in order to improve the readability of their code. However, most popular programming languages forbid the use of spaces inside identifiers, since they are interpreted as delimiters between tokens. The alternative of writing the words together as in "endoffile" or "chartable" is not satisfactory, since the word boundaries may be quite difficult to discern in the result.

Some early programming languages, notably Lisp (1958) and COBOL (1959), addressed this problem by allowing a hyphen ("-") to be used between words of compound identifiers, as in "END-OF-FILE". However, this solution was not adequate for algebraic-oriented languages such as FORTRAN (1955) and ALGOL (1958), which used the hyphen as an intuitively-obvious subtraction operator. (FORTRAN also restricted identifiers to six characters or fewer at the time, preventing multi-word identifiers except those made of very short words.) Since the common punched card character sets of the time had no lower-case letters and no other special character that would be adequate for the purpose, those early languages had to do without multi-word identifiers.

It was only in the late 1960s that the widespread adoption of the ASCII character set made both lower case and the underscore character "_" universally available. Some languages, notably C, promptly adopted underscores as word separators; and underscore-separated compounds like "end_of_file" are still prevalent in C programs and libraries. However, some languages and programmers chose to avoid underscores and adopted camel case instead. Two accounts are commonly given for the origin of this convention.

The "Lazy Programmer" theory

One theory for the origin of the camel case convention holds that C programmers and hackers simply found it more convenient than the standard underscore-based style.

The underscore key is inconveniently placed on American QWERTY keyboards. Additionally, in some fonts the underscore character can be confused with a minus sign; it can be overlooked because it falls below the string of characters or it can be lost entirely when displayed or printed underlined or when printed on a dot-matrix printer with a defective pin or misaligned ribbon. Moreover, early compilers severely restricted the length of identifiers (e.g., to 8 or 14 letters) or silently truncated all identifiers to that length. Finally, the small size of computer displays available in the 1970s encouraged the use of short identifiers. Many C programmers opted to use camel case instead of underscores, for it yielded legible compound names with fewer keystrokes and fewer characters.

In addition, many C compilers reserve the use of single or double leading underscores for reserved words, compiler directives, or to indicate visibility, e.g. _somePrivateVariable or __HASSOMELIBRARY.[25] While this usage would not rule out medial underscores, avoiding them can give the resulting code greater readability.

The "Alto Keyboard" theory

Another account claims that the camel case style first became popular at Xerox PARC around 1978, with the Mesa programming language developed for the Xerox Alto computer. This machine lacked an underscore key and the hyphen and space characters were not permitted in identifiers, leaving camel case as the only viable scheme for readable multiword names. The PARC Mesa Language Manual (1979) included a coding standard with specific rules for Upper- and lowerCamelCase which was strictly followed by the Mesa libraries and the Alto operating system.

The Smalltalk language, which was developed originally on the Alto and became quite popular in the early 1980s, may have been instrumental in spreading the style outside PARC. Camel case was also used by convention for many names in the PostScript page description language (invented by Adobe Systems founder and ex-PARC scientist John Warnock), as well as for the language itself. A further boost was provided by Niklaus Wirth (the inventor of Pascal) who acquired a taste for camel case during a sabbatical at PARC and used it in Modula, his next programming language.

Spread to mainstream usage

Whatever its origins within the computing world, camel case spread to a wider audience in the 1980s and 1990s, when the advent of the personal computer exposed hacker culture to the world. Camel case then became fashionable for corporate trade names, first in computer-related fields but later expanding further into the mainstream. Examples ranging from the 1970s to the 2000s give a history of the spread of the usage:

During the dot-com bubble of the late 1990s, the lowercase prefixes "e" (for "electronic") and "i" (for "Internet",[28] "information", "intelligent", etc.) became quite common, giving rise to some camel case names like Apple's iMac and the eBox software platform.

In 1998, Dave Yost suggested that chemists use medial capitals to aid readability of long chemical names, e.g. write AmidoPhosphoRibosylTransferase instead of amidophosphoribosyltransferase.[29]

This practice is sometimes given to the abbreviated names of certain neighborhoods, particularly New York City neighborhoods, such as SoHo (South of Houston Street) and TriBeCa (Triangle Below Canal Street). Camel case is not always used and the neighborhoods are instead rendered as Soho and Tribeca.

History of the name "camel case"

The original name of the practice, used in media studies, grammars and the Oxford English Dictionary, was "medial capitals". The fancier names such as "InterCaps", "CamelCase" and variations thereof are relatively recent and seem more common in computer-related communities.

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,[6] with "BiCapitalization" appearing slightly later in a 1991 post by Eric S. Raymond to the same group.[30] The earliest use of the name "CamelCase" occurs in 1995, in a post by Newton Love.[31] "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," said Love, "The citation above was just the first time I had used the name on USENET."[32]

The name "CamelCase" is not related to the "Camel Book" (Programming Perl), which uses all-lowercase identifiers with underscores in its sample code.

Current usage in computing

Programming and coding

The use of medial caps for compound identifiers is recommended by the coding style guidelines of many organizations or software projects. For some languages (such as Mesa, Pascal, Modula, Java, Google SOC's Python recommendations,[33] and Microsoft's .NET) this practice is recommended by the language developers or by authoritative manuals and has therefore become part of the language's "culture". (Note that Google's SOC is a project rather than a language - the use of camel case is not standardised by the Python language and much Python code makes use of underscores to delimit variable names).

Style guidelines often distinguish between upper and lower camel case, typically specifying which variety should be used for specific kinds of entities: variables, record fields, methods, procedures, types, etc. These rules are sometimes supported by static analysis tools that check source code for adherence.

The original Hungarian notation for programming, for example, specifies that a lowercase abbreviation for the "usage type" (not data type) should prefix all variable names, with the remainder of the name in upper camel case; as such it is a form of lower camel case.

Programming identifiers often need to contain acronyms and initialisms which are already in upper case, such as "old HTML file". By analogy with the title case rules, the natural camel case rendering would have the abbreviation all in upper case, namely "oldHTMLFile". However, this approach is problematic when two acronyms occur together (e.g., "parse DBM XML" would become "parseDBMXML") or when the standard mandates lower camel case but the name begins with an abbreviation (e.g. "SQL server" would become "sQLServer"). For this reason, some programmers prefer to treat abbreviations as if they were lower case words and write "oldHtmlFile", "parseDbmXml" or "sqlServer".

Wiki link markup

Camel case is used in some wiki markup languages for terms that should be automatically linked to other wiki pages. This convention was originally used in Ward Cunningham's original wiki software, the WikiWikiWeb and is still used by some other wikis, such as FosWiki, JSPWiki, TiddlyWiki, Trac and PMWiki. Wikipedia formerly used camel case linking as well, but switched to explicit link markup using square brackets and many other wiki sites have done the same. Some wikis which use a different link markup by default have an option (sometimes with a plugin) to enable camel case links. Some wikis which do not use camel case linking may still use the camel case as a naming convention, such as AboutUs.

Other uses

The NIEM registry requires that XML data elements use upper camel case and XML attributes use lower camel case.

Most popular command-line interfaces and scripting languages cannot easily handle file names that contain embedded spaces (usually requiring the name to be put in quotes). Therefore, users of those systems often resort to camel case (or underscores, hyphens and other "safe" characters) for compound file names like MyJobResume.pdf.

Current usage in natural languages

Camel case has been used in languages other than English for a variety of purposes, including the ones below:

Orthographic markings

Camel case is sometimes used in the transcription of certain scripts, to differentiate letters or markings. An example is the rendering of Tibetan proper names like rLobsang: the "r" here 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 Chechenia and Ingushetia; the capital letter "I" here denoting a phoneme distinct from the one transcribed as "i".

Inflection prefixes

Camel case may also be used when writing proper names in languages that inflect words by attaching prefixes to them. In some of those languages, the custom is to leave the prefix in lower case and capitalize the root.

This convention is used in Irish orthography as well as Scots Gaelic orthography; e.g., i nGaillimh ("in Galway"), from Gaillimh ("Galway"); an tAlbanach ("the Scottish person"), from Albanach ("Scottish person"); go hÉireann ("to Ireland"), from Éire ("Ireland).

Similarly, in transliteration of the Hebrew language, haIvrit means "the Hebrew person" and biYerushalayim means "in Jerusalem".

This convention is also used by several Bantu languages (e.g., kiSwahili = "Swahili language", isiZulu = "Zulu language") and several indigenous languages of Mexico (e.g. Nahuatl, Totonacan, Mixe–Zoque and some Oto-Manguean languages).

In abbreviations and acronyms

Abbreviations of some academic qualifications are sometimes presented in camel case without punctuation, e.g. PhD or BSc.

In French, camel case acronyms such as OuLiPo (1960) 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 ДШК.

Honorifics within compound words

In several languages, including English, pronouns and possessives may be capitalized to indicate respect, e.g., when referring to the reader of a formal letter or to God. In some of those languages, the capitalization is customarily retained even when those words occur within compound words or suffixed to a verb. For example, in Italian one would write porgendoLe distinti saluti ("offering to You respectful salutations") or adorarLo ("adore Him").

Other uses

In German, all nouns carry a grammatical gender—which, for roles or job titles, is usually masculine. Since the feminist movement of the 1980s, some writers and publishers have been using the feminine title suffixes -in (singular) and -innen (plural) to emphasize the inclusion of females; but written with a capital 'I', to indicate that males are not excluded. Example: MitarbeiterInnen ("co-workers, male or female") instead of Mitarbeiter ("co-workers", masculine grammatical gender) or Mitarbeiterinnen' ("female co-workers"). This use is analogous to the use of parentheses in English, for example in the phrase "congress(wo)man."

In German, the names to statutes are also abbreviated using embedded capitals, e.g. StGB (Strafgesetzbuch) for criminal code and PatG (Patentgesetz) for Patent Act.

See also

References

  1. ^ www.askoxford.com. "What is the name for a word containing two capital letters (like WordPad)?". AskOxford. http://www.askoxford.com/asktheexperts/faq/aboutwords/medial. Retrieved 2009-05-23. 
  2. ^ a b c Brian Hayes, "The Semicolon Wars,"American Scientist Online: The Magazine of Sigma XI, the Scientific Research Society July–August 2006, art. pg. 2.
  3. ^ C# Coding Standards and Guidelines at Purdue University College of Technology
  4. ^ "CamelCase@Everything2.com". Everything2.com. http://everything2.com/title/CamelCase. Retrieved 2010-06-04. 
  5. ^ a b Style Guide for Python Code at www.python.org
  6. ^ a b compoundName, discussion thread at alt.folklore.computers (Mar 29 1990)
  7. ^ "[#APF-1088] If class name has embedded capitals, AppGen code fails UI tests and generated hyperlinks are incorrect. - AppFuse JIRA". Issues.appfuse.org. http://issues.appfuse.org/browse/APF-1088. Retrieved 2010-06-04. 
  8. ^ ASP Naming Conventions, by Nannette Thacker (05/01/1999)
  9. ^ Iverson, Cheryl, et al. (eds) (2007). AMA Manual of Style (10th ed.). Oxford, Oxfordshire: Oxford University Press. ISBN 9780195176339. 
  10. ^ Christine A. Hult and Thomas N. Huckin. "The Brief New Century Handbook - Rules for internal capitalization". Pearson Education. http://wps.ablongman.com/long_hult_bnch_4/63/16207/4149058.cw/content/index.html. 
  11. ^ Brad Abrams : History around Pascal Casing and Camel Casing
  12. ^ Pascal Case
  13. ^ .NET Framework General Reference Capitalization Styles
  14. ^ "WikiWord < TWiki < TWiki". Twiki.org. http://twiki.org/cgi-bin/view/TWiki/WikiWord. Retrieved 2010-06-04. 
  15. ^ "Wiki Case". C2.com. 2010-02-08. http://c2.com/cgi/wiki?WikiCase. Retrieved 2010-06-04. 
  16. ^ Title Case in PHP at SitePoint Blogs
  17. ^ WordTips: Intelligent Title Case
  18. ^ How to: Change casing in Text to TitleCase - Jan Schreuder on .Net
  19. ^ Jöns Jacob Berzelius (1813). Essay on the Cause of Chemical Proportions and on Some Circumstances Relating to Them: Together with a Short and Easy Method of Expressing Them. Annals of Philosophy 2, 443-454, 3, 51-52; (1814) 93-106, 244-255, 353-364
  20. ^ Henry M. Leicester & Herbert S. Klickstein, eds. (1952, A Source Book in Chemistry, 1400-1900 (Cambridge, MA: Harvard)
  21. ^ Fowler, Henry W.; Fowler, Francis G. (1908). "Chapter IV. Punctuation - Hyphens". The King's English (2nd ed.). Oxford. http://www.bartleby.com/116/405.html. Retrieved 19 December 2009. 
  22. ^ "MisteRogers" (1962)
  23. ^ "Resume of Session 8". Digital Computers: Advanced Coding Techniques. Summer Session 1954, Massachusetts Institute of Technology, page 8-6.
  24. ^ Strachey, Christopher (October 1965). "A General Purpose Macrogenerator". Computer Journal 8 (3): 225–241. doi:10.1093/comjnl/8.3.225. 
  25. ^ ".NET Programming Standards and Naming". http://visual-studio2008.blogspot.com/2008/05/net-programming-standards-and-naming.html. 
  26. ^ Unitedhealthgroup.com
  27. ^ PWCglobal.com
  28. ^ Farhad Manjoo. "Grads Want to Study on EMacs, Too". Wired.com. http://www.wired.com/science/discoveries/news/2002/04/52181. Retrieved 2010-06-04. 
  29. ^ Feedback, 20 June 1998 Vol 158 No 2139 New Scientist 20 June 1998
  30. ^ "The jargon file version 2.5.1 29 January 1991 follows in 15 parts - misc.misc | Google Groups". Groups.google.com. http://groups.google.com/group/misc.misc/msg/f5f25b79cd9026bd. Retrieved 2009-05-23. 
  31. ^ Newton Love   View profile    More options. "I'm happy again! - comp.os.os2.advocacy | Google Groups". Groups.google.com. http://groups.google.com/group/comp.os.os2.advocacy/msg/ab3c8107c6e150fa. Retrieved 2009-05-23. 
  32. ^ Newton Love
  33. ^ "PythonStyleGuide - soc - Style guide for Python code contributed to Melange - Project Hosting on Google Code". Code.google.com. http://code.google.com/p/soc/wiki/PythonStyleGuide#Naming. Retrieved 2010-06-04. 

External links


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Camelcase — sur un panneau de direction (les mots champions et gate sont mis bout à bout et le second commence par une majuscule pour marquer la séparation) CamelCase (littéralement : casse de chameau) est un terme anglais utilisé dans l informatique et …   Wikipédia en Français

  • CamelCase — sur un panneau de direction (les mots champions et gate sont mis bout à bout et le second commence par une majuscule pour marquer la séparation) CamelCase (littéralement : « casse de chameau ») est un terme anglais utilisé dans l… …   Wikipédia en Français

  • CamelCase — es la práctica de escribir frases o palabras compuestas eliminando los espacios y poniendo en mayúscula la primera letra de cada palabra. El nombre viene del parecido de estas mayúsculas, entre las demás letras, con las jorobas de los camellos.… …   Enciclopedia Universal

  • CamelCase — У этого термина существуют и другие значения, см. Camel. CamelCase (рус. ВерблюжийРегистр, также ГорбатыйРегистр, СтильВерблюда)  стиль написания составных слов, при котором несколько слов пишутся слитно без пробелов, при этом каждое слово… …   Википедия

  • CamelCase — Binnenmajuskel in der Werbung‎ Binnenmajuskel (die, Plural Binnenmajuskeln) oder Binnenversal, auch Binnenversalie, nennt man einen Großbuchstaben (Versalie, Majuskel) im Wortinnern (Binnen ). Eine Sonderform, die Auszeichnung der einzelnen… …   Deutsch Wikipedia

  • CamelCase — Ejemplo de CamelCase en un indicador. CamelCase es un estilo de escritura que se aplica a frases o palabras compuestas. El nombre se debe a que las mayúsculas a lo largo de una palabra en CamelCase se asemejan a las jorobas de un camello. El… …   Wikipedia Español

  • CamelCase — noun the practice of writing compound words with internal majuscules …   Wiktionary

  • Casse de chameau — CamelCase CamelCase sur un panneau de direction (les mots champions et gate sont mis bout à bout et le second commence par une majuscule pour marquer la séparation) CamelCase (littéralement : casse de chameau) est un terme anglais utilisé… …   Wikipédia en Français

  • ChatMot — CamelCase CamelCase sur un panneau de direction (les mots champions et gate sont mis bout à bout et le second commence par une majuscule pour marquer la séparation) CamelCase (littéralement : casse de chameau) est un terme anglais utilisé… …   Wikipédia en Français

  • Liens libres — CamelCase CamelCase sur un panneau de direction (les mots champions et gate sont mis bout à bout et le second commence par une majuscule pour marquer la séparation) CamelCase (littéralement : casse de chameau) est un terme anglais utilisé… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.