Friday, August 31, 2007

CamelCase (also spelled camel case) or medial capitals is the practice of writing compound words or phrases in which the words are joined without spaces and are capitalized within the compound. The term's name comes from the uppercase "bumps" in the middle of the compound word, suggestive of the humps of a camel. An example is BackColor.
There are many other names for this practice, including BiCapitalization, InterCaps, InfixCaps, MixedCase, and PolyCaps. CamelCase is a standard identifier naming convention for several programming languages, and has become fashionable in marketing for names of products and companies. Outside these contexts, however, CamelCase is rarely used in formal written English, and most style guides recommend against its use.

Variations and synonyms
The term StudlyCaps is similar — but not necessarily identical — to CamelCase. It is sometimes used in reference to CamelCase but can also refer to random mixed capitalisation (as in "MiXeD CaPitALiSaTioN") as popularly used in online culture.
The term Title Case is also similar, but Title Case has spaces between the words. Title Case also doesn't usually uppercase certain small words such as 'and' and 'the'.[4][5][6]

Similar terms

CamelCase has been sporadically used since ancient times, for example as a traditional spelling style for certain surnames, such as in Scottish names like MacLean ("son of Gilian") and Hiberno-Norman names like FitzGerald (originally, "son of Gerald"). Often, names from French origin are spelled this way in English, though they never are in French. The name and preposition will appear as a single capitalized word (Dupont) or with a space between the (lowercased) preposition and the capitalized word. (du Pont) e.g. the DuPont company was founded by Eleuthère Irénée du Pont ("of/from the bridge"). In the mid-20th century, it was used occasionally for product trademarks, such as CinemaScope and VistaVision, rival widescreen movie formats introduced in the 1950s. CamelCase also occurred sometimes in acronyms like DoD, or technical codes and formulas like HeLa (1983). CamelCase has also been used to transliterate acronyms from alphabets such as Cyrillic where two letters may be required to represent a single character of the original alphabet. An example of this is the DShK (Cyrillic: ДШК).

Early uses

Software Engineering
In programs of any significant size, there is a need for descriptive (hence multi-word) identifiers, like "previous balance" or "end of file". However, spaces are not typically permitted inside identifiers, as they are treated as delimiters between tokens. Writing the words together as in "endoffile" is not satisfactory because the names often become unreadable. Therefore, the programming language COBOL allowed a hyphen ("-") to be used between words of compound identifiers, as in "END-OF-FILE".
Most programming languages, however, interpret the hyphen as a subtraction operator and do not allow the character in identifier names. The common punched card character sets of the time had no lower-case letters and no special character that would be adequate as a word separator in identifiers. However, by the late 1960s the ASCII character set standard had been established, allowing the designers of the C language to adopt the underscore character "_" as a word joiner. Underscore-separated compounds like "end_of_file" are still prevalent in C programs and libraries.
CamelCase is by no means universal in computing. Users of several modern programming languages, notably those in the Lisp and Forth families, nearly always use hyphens. Among the reasons sometimes given are that doing so does not require shifting on most keyboards, and that the words are more readable when they are separated.
The use of CamelCase became widespread only in the 1970s or 1980s, when it was adopted as a standard or alternative naming convention for multi-word identifiers in several programming languages.

Programming and coding style
One explanation of the origins of CamelCase in computing claims that the style originated within the culture of C programmers and hackers, who found it more convenient than the standard underscore-based style.
On most keyboards, the underscore key is inconveniently placed. 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, compiler limits on identifier length and the small computer displays available in the 1970s worked together to encourage brevity. Many programmers thus chose to use CamelCase for it yielded legible compound names with fewer keystrokes and fewer characters.

The "Lazy Programmer" origin
Programmers working in the tradition of linkage oriented languages, especially the Unix C tradition (and later C++), had many concerns to address. Early Unix systems (and early personal computers in general) provided linkage models where external identifiers were distinguished to a short length, often as few as the initial eight characters. Many clashes were possible within the external identifier linkage space which potentially mingles code generated by various high level compilers, runtime libraries required by each of these compilers, compiler generated helper functions, and program startup code, of which some fraction was inevitably compiled from system assembly language. Within this collision domain the underscore character quickly became entrenched as the primary mechanism for differentiating the external linkage space. It was common practice for C compilers to prepend a leading underscore to all external scope program identifiers to avert clashes with contributions from runtime language support. Furthermore, when the C/C++ compiler needed to introduce names into external linkage as part of the translation process, these names were often distinguished with some combination of multiple leading or trailing underscores.
This practice was later codified as part of the C and C++ language standards, in which the use of leading underscores was reserved for the implementation.
A second, independent collision domain was the C preprocessor. The C language preprocessor is unusual in that it does not respect any language-defined scoping model or reserved namespace, not even C language keywords. This problem was generally addressed by writing macros in macro case which mostly mixes upper case letters with dividing underscores:
Once again the implementation must often supply hidden macros, and once again dressing up these "hidden behind the scenes" identifiers with multiple leading or trailing underscores became accepted practice. As this practice became pervasive on both levels, the underscore gained a cognitive association with system level programming, hidden technicalities, and the messy entrails of language support.
The C language linkage model further complicated matters by not supporting a strong module-level linkage model. In the C language the concept of module was initially rather loose. There was no language distinction between function names intended for linkage to other compilation units and function names intended only for use within a single compilation unit to simplify the implementation. The C language provides the static keyword which makes it possible to hide names from external linkage, but this was rarely employed, as it also obscured these names from most runtime debugging tools.

The "Paranoid Programmer" origin
Another explanation is that CamelCase started 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 CamelCase 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. CamelCase 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). Further boost was provided by Niklaus Wirth — the inventor of Pascal — who acquired a taste for CamelCase during a sabbatical at PARC, and used it in Modula, his next programming language.

The "Alto Keyboard" origin
During the same period in which personal computers exposed hacker culture to a more mainstream audience in the 1980s and 1990s, CamelCase became fashionable for corporate trade names, first in computer-related fields but later expanding further into the mainstream. The city of SeaTac, Washington is the first city officially spelled in CamelCase. Though not technically CamelCase, during the dot-com bubble of the late 1990s, in particular, the lowercase prefixes "e" (for "electronic") and "i" (for "Internet", "information", or perhaps "intelligent") became quite common. Examples ranging from the 1960s to the 2000s give a history of the spread of the usage:
This fashion has become so pervasive that it is often incorrectly applied to names that do not use it officially, as in TransAmerica (Transamerica), FireFox (Firefox), UseNet (Usenet), GameBoy (Game Boy), MacWorld (Macworld), and CalTech (Caltech).

(1962) ShopKo, MisteRogers (Canadian version of Mister Rogers)[8]
(1967) AstroTurf
(1971) ConAgra (formerly Consolidated Mills)
(1975) MicroSoft (now Microsoft)
(1977) CompuServe, UnitedHealthCare (now UnitedHealthcare [9], with several other variations of capitalization and spacing over the years)
(1979) MasterCard, SportsCenter, VisiCalc
(1980) EchoStar
(1982) AutoCAD, WordPerfect
(1983) NetWare
(1984) BellSouth, LaserJet, MacWorks
(1985) PageMaker, EastEnders
(1986) SpaceCamp
(1987) ClarisWorks, HyperCard, PowerPoint
(1989) MicroStrategy
(1990) HarperCollins
(1991) QuickTime, PowerBook, SuperAmerica
(1992) OutKast (hip hop band), ThinkPad
(1993) AmeriCorps, ValuJet (now AirTran Airways), SolidWorks
(1994) EarthLink, PlayStation, easyJet (an early use of CamelCase with lowercase first letter)
(1995) RealPlayer, WorldCom (now MCI)
(1996) RadioShack (formerly Radio Shack)
(1997) TiVo
(1998) DaimlerChrysler, PricewaterhouseCoopers (logo), iMac
(1999) BlackBerry, DragonForce (British Power Metal band, originally DragonHeart), SpongeBob SquarePants
(2000) FedEx (formerly Federal Express), GlaxoSmithKline, PayPal
(2001) AmerisourceBergen, ChevronTexaco (now Chevron), GameCube
(2002) ConocoPhillips
(2003) MySpace
(2005) YouTube, PetSmart (formerly PETsMART) CamelCase Spread to mainstream usage
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 [10], with BiCapitalization appearing slightly later in a 1991 post by Eric S. Raymond to the same group [11]. The earliest use of the name "CamelCase" occurs in 1995, in a post by Newton Love. [12]. "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 Newton, [13] "The citation above was just the first time I had used the name on USENET."
The name CamelCase is not related to the "Camel book" (Programming Perl), which uses all-lowercase identifiers with underscores in its sample code.

CamelCase History of the name

Usage in Other Languages
For almost two centuries, chemistry has had its own international language based on CamelCase identifiers for molecules.
For example: NaCl for common table salt.
Or: GaAs for Gallium Arsenide
Reference: Jöns Jacob Berzelius. 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 (1813), 3, 51-2, 93-106, 244-255, 353-364 (1814) [from Henry M. Leicester & Herbert S. Klickstein, eds., A Source Book in Chemistry, 1400-1900 (Cambridge, MA: Harvard, 1952)]

CamelCase in Chemistry Language
CamelCase has been used in languages other than English for a variety of purposes, such as the transcription of Tibetan names like rLobsang, or names of Bantu languages like kiSwahili or isiZulu. In French, abbreviations such as OuLiPo (1960) were favored for a time as alternatives to acronyms. In Irish orthography, when a word has undergone eclipsis, only the letter corresponding to the unmutated form is capitalized; for example Gaillimh means "Galway", and its initial letter is the one capitalized in i nGaillimh "in Galway". The same holds when t or h is prefixed to a capital letter: an tAlbanach "the Scottish person" (from Albanach "Scottish person"), an tSín "China" (cf. Síneach "Chinese person"), go hÉireann "to Ireland" (from Éire "Ireland).

CamelCase in Natural Languages
In the German language, nouns carry a grammatical gender, which as for words indicating the role of someone, like job titles, is mostly masculine. A capital I marking the beginning of the feminine title suffix "In" (and "Innen" for plural) has since the 80s become customary in those German language media circulating among a feminist or left-wing readership as a politically meaningful spelling to emphasize the inclusion of females. Example: LeserInnenbriefe instead of Leserbriefe (Letters from readers).


All caps
Naming conventions (programming)

No comments: