Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Camel case
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Computer programming === {{Original research|section|date=May 2011}} In the 1970s and 1980s, medial capitals were adopted as a standard or alternative [[naming convention (programming)|naming convention]] for multi-word [[Identifier (computer programming)|identifier]]s in several [[programming language]]s. The precise origin of the convention in computer programming has not yet been settled. A 1954 conference proceedings<ref>{{cite web |url=http://www.bitsavers.org/pdf/mit/summer_session_1954/Digital_Computers_Advanced_Coding_Techniques_Summer_1954.pdf |title="Resume of Session 8". Digital Computers: Advanced Coding Techniques. Summer Session 1954, Massachusetts Institute of Technology |pages=8β6 |date=1954 |access-date=4 January 2014 |archive-url=https://web.archive.org/web/20120229201504/http://bitsavers.org/pdf/mit/summer_session_1954/Digital_Computers_Advanced_Coding_Techniques_Summer_1954.pdf |archive-date=29 February 2012 |url-status=dead }}</ref> occasionally informally referred to [[IBM]]'s [[Speedcoding]] system as "SpeedCo". [[Christopher Strachey]]'s paper on [[General purpose macro processor#Examples of general purpose macro processors|GPM]] (1965),<ref>{{cite journal |last=Strachey |first=Christopher |author-link=Christopher Strachey |title=A General Purpose Macrogenerator |journal=Computer Journal |volume=8 |issue=3 |pages=225β241 |date=October 1965 |doi=10.1093/comjnl/8.3.225|doi-access=free }}</ref> shows a program that includes some medial capital identifiers, including "<code>NextCh</code>" and "<code>WriteSymbol</code>" (This was most likely the influence of the [[CPL_(programming_language)|CPL]] language, of which Strachey was one of the designers) Multiple-word descriptive identifiers with embedded spaces such as <code>end of file</code> or <code>char table</code> cannot be used in most programming languages because the spaces between the words would be [[Parser|parsed]] as [[delimiter]]s between [[Lexical analysis#Token|tokens]]. The alternative of running the words together as in <code>endoffile</code> or <code>chartable</code> is difficult to understand and possibly misleading; for example, <code>chartable</code> is an English word (able to be charted), whereas <code>charTable</code> means a table of <code>chars</code> . Some early programming languages, notably [[Lisp (programming language)|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": Lisp because it worked well with prefix notation (a Lisp parser would not treat a hyphen in the middle of a symbol as a subtraction operator) and COBOL because its operators were individual English words. This convention remains in use in these languages, and is also common in program names entered on a [[command line]], as in Unix. However, this solution was not adequate for mathematically oriented languages such as [[FORTRAN]] (1955) and [[ALGOL 58|ALGOL]] (1958), which used the hyphen as an infix subtraction operator. FORTRAN ignored blanks altogether, so programmers could use embedded spaces in variable names. However, this feature was not very useful since the early versions of the language restricted identifiers to no more than six characters. Exacerbating the problem, common [[punched card]] character sets of the time were uppercase only and lacked other special characters. It was only in the late 1960s that the widespread adoption of the [[ASCII]] character set made both lowercase and the [[underscore]] character <code>_</code> universally available. Some languages, notably [[C (programming language)|C]], promptly adopted underscores as word separators, and identifiers such as <code>end_of_file</code> are still prevalent in C programs and libraries (as well as in later languages influenced by C, such as [[Perl]] and [[Python (programming language)|Python]]). However, some languages and programmers chose to avoid underscores and adopted camel case instead. [[Charles Simonyi]], who worked at [[Xerox PARC]] in the 1970s and later oversaw the creation of Microsoft's Office suite of applications, invented and taught the use of [[Hungarian Notation]], one version of which uses the lowercase letter(s) at the start of a (capitalized) variable name to denote its type. One account{{citation needed|date=January 2017}} claims that the camel case style first became popular at Xerox PARC around 1978, with the [[Mesa (programming language)|Mesa programming language]] developed for the [[Xerox Alto]] computer. This machine lacked an underscore key (whose place was taken by a left arrow "β"), 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 lower camel case that was strictly followed by the Mesa libraries and the Alto operating system. [[Niklaus Wirth]], the inventor of [[Pascal (programming language)|Pascal]], came to appreciate camel case during a sabbatical at PARC and used it in [[Modula]], his next programming language.<ref>{{cite book | doi = 10.1145/1238844.1238847 | chapter-url = http://portal.acm.org/citation.cfm?id=1238847 | author = Niklaus Wirth | title = Proceedings of the third ACM SIGPLAN conference on History of programming languages | chapter = Modula-2 and Oberon | pages = 3-1β3-10 |series = [[History_of_Programming_Languages_(conference)#HOPL_III|HOPL III - San Diego]] | year = 2007 | citeseerx = 10.1.1.91.1447 |isbn = 9781595937667 | s2cid = 1918928 }}</ref> The [[Smalltalk]] language, which was developed originally on the Alto, also uses camel case instead of underscores. This language became quite popular in the early 1980s, and thus may also have been instrumental in spreading the style outside PARC. Upper camel case (or "Pascal case") is used in [[Wolfram Language]] in computer algebraic system [[Mathematica]] for predefined identifiers. User defined identifiers should start with a lower case letter. This avoids the conflict between predefined and user defined identifiers both today and in all future versions. C# variable names are recommended to follow the lower camel case convention.<ref>{{Cite web |last=wwlpublish |title=Declare variables - Training |url=https://learn.microsoft.com/en-us/training/modules/csharp-literals-variables/3-declaring-variables |access-date=2023-08-29 |website=learn.microsoft.com |language=en-us}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)