TheBestLinks.com
TheBestLinks.com
BiCapitalized, CamelCase, ASCII, Amiga, Computing, Cinema, C programming ... Print friendly version | Tell a friend
 
Navigation
Search
Toolbox

CamelCase

From TheBestLinks.com

(Redirected from BiCapitalized)

Bicapitalization or camel case (frequently written CamelCase) is the practice of writing compound words or phrases where the terms are joined without spaces, and every term is capitalized. The name comes from a supposed resemblance between the bumpy outline of the compound word and the humps of a camel.

CamelCase is a standard identifier naming convention for several programming languages, and has become fashionable in marketing for names of products and companies.

The term "camel case" is sometimes used, especially when used with respect to computer languages related to C and Java, to mean naming program variables "likeThis", while Pascal case is reserved for variables named "LikeThis". This usage seems more appropriate to the metaphor, as the humps of camels are in the middle of their bodies, and not on either end.

CamelCase synonyms include:

  • BiCapitalized
  • BumpyCase
  • CamelCaps
  • CamelHumpedWord
  • CapWords in Python (reference) (http://www.python.org/peps/pep-0008.html)
  • ClCl (Capital-lower Capital-lower) and sometimes ClC
  • HumpBackNotation
  • InterCaps
  • InternalCapitalization
  • MixedCase
  • NerdCaps
  • Pascal case (used by Microsoft)
  • StudlyCaps
  • WordsStrungTogether or WordsRunTogether
  • WikiWord in TikiWiki (reference) (http://wiki.java.net/bin/view/TWiki/WikiWord)
  • WikiName
Table of contents

Origins of CamelCase

CamelCase has been sporadically used since ancient times, for example as a traditional spelling style for Scottish surnames like McDonald, in some acronyms like "DoE" (for the U.S. "Department of Energy"), and in marketing for naming corporations and products, such as the CinemaScope movie projection system introduced in the 1950s.

However, 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. There are two theories as to why and where that custom started.

Multiword identifiers

In programs of any significant size, there is a need for descriptive (hence multi-word) identifiers, like "previous balance" or "end of file". Writing the words together as in "endoffile" is not satisfactory since the names often become unreadable. Therefore, the pioneer programming language COBOL allowed a hyphen ("-") to be used between words of compound identifiers, as in "END-OF-FILE". The contemporary "algebraic" language Fortran preempted the hyphen for the minus operator, but allowed spaces to be arbitrarily embedded into identifiers, so that "TOTAMP" could be written "TOT AMP" (or "TO TAMP"). However, this feature was largely useless because most Fortran compilers did not allow identifiers longer than six letters.

It should be noted that 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 was already established, and so the designers of the C language could adopt the underscore character "_" as word joiner. Underscore-separated compounds like "end_of_file" are still prevalent in C programs and libraries.

The "Lazy Programmer" theory

One theory on 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.

Indeed, in most keyboards the underscore key is inconveniently placed, and must be typed with the help of the SHIFT key. Also, in many fonts the underscore character is easily confused with a blank space or with a minus sign. Moreover, compiler limits on identifier length and the small computer displays available in the 1970s worked together to encourage brevity. So — according to this theory — many programmers chose to use CamelCase instead, because it yielded legible compound names with fewer keystrokes and fewer characters.

The "Alto Keyboard" theory

Another theory is that CamelCase actually started at Xerox PARC around 1978, with the Mesa programming language developed for the Xerox Alto computer. This machine lacked an underscore key, so the Mesa libraries and the Alto operating system had to be coded all in CamelCase.

The Smalltalk language, which was also developed originally on the Alto and became quite popular in the early 1980s, may have been instrumental in spreading the style outside PARC. Another boost was provided by Niklaus Wirth — the inventor of Pascal — who acquired the taste for CamelCase during a sabbatical at PARC, and used it in Modula, his next programming language.

The spread of CamelCase

Be that as it may, CamelCase eventually spread via hacker culture into mainstream use, probably because of the popularization of the personal computer in the 1980s and 1990s, and became fashionable for corporate trade names. Here are some examples:

CamelCase has been also common among mobile phone users, thanks to the popularization of SMS (Short message service) in the late 1990s. With only 160 characters per one short text message, CamelCase makes it possible to optimize the message by excluding the spaces.

CamelCase and coding standards

CamelCase is now recommended or enforced by many computer systems, and mandated by the coding standards of many programming languages — such as Mesa, the systems programming language of the Xerox Alto, or the modern language Java. It is also the official convention for file names in Java and of the Amiga personal computers.

Coding standards often distinguish two important variations of the style. In the so-called upper CamelCase, the first letter of every word is written in upper case, as in "TheColourOfTheBar". In lower CamelCase the first word is left uncapitalized, as in "theColourOfTheBar". Coding standards typically specify which of these variants should be used for specific kinds of entities — variables, record fields, methods, procedures, types, etc. For instance, Java coding style dictates that UpperCamelCase should be used for classes, and lowerCamelCase should be used for instances and members.

In the Microsoft .NET Guidelines, Camel case is defined as lower CamelCase, while upper CamelCase is called Pascal case.

See also

External links


de:CamelCase

Related links


Top visited 0 of 0 links

[no links posted yet]

>> place link >>

Discussion

Last posted 0 of 0 messages

[no messages posted yet]

>> post message >>

Watch

You can add this article to your own "watchlist" and receive e-mail notification about all changes in this page.
 
   
Innovate it
This page was last modified 15:25, 18 Sep 2004.
  Content is available under GNU Free Documentation License 1.2.
Powered by MediaWiki