Speculation about the origin of CamelCase

Prompted by Avdi Grimm’s post on underscores in program identifiers, I’ll publicly air my guess about why theBlightOfCamelCaseInfestsOurPrograms when_identifiers_with_underscores_are_obviously_more_readable. (Although Avdi is right that dashes are superior to both.)

As far as I can tell, the popularity of camel case came from Java, which got it from Smalltalk. But where did Smalltalk get it, and why did such smart people go so badly astray?

Flash back to 1979-1981. I was a computer operator for a PDP-10 mainframe at the University of Illinois Coordinated Science Lab. (I still have two pieces of that computer in my basement.) We had a bunch of VT-100 act-alike terminals. But off in a corner, where no one ever used it, we had a single terminal we called “the European terminal”. One interesting thing about the European terminal was that it had no underscore key. Instead, it had a back-arrow key. I have a faint recollection that if you viewed text with underscores on that terminal, it would show up with back arrows instead. (Or was it that the keyboard did have an underscore on it, but when you pressed it, it displayed a back arrow?)

It’s unlikely you’d write←identifiers←with←back←arrows←in←them and, in any case, some programming languages (such as Smalltalk) use back arrow to mean assignment (instead of, as was common before C took off, `:=`).

All of which makes me think—especially since Smalltalk came from Simula, and Simula came from Europe—was there no underscore available to the people who built Smalltalk back in its early days? Was that why they fell back on StudlyCaps?

(I even have a very dim memory of some language—I don’t think it was Smalltalk—where underscore, as well as a back arrow, could be used for assignment.)

Does anyone know?

5 Responses to “Speculation about the origin of CamelCase”

  1. Michael Says:

    S, and therefore R, uses underscore as well as ASCII ‘

  2. Brian Marick Says:

    @kragan says: “Yes, Smalltalk used the ASCII-1963 standard, in which _ was ← and ^ was ↑, rather than 1967. And ← was assignment. Still is.”

    and

    “Squeak only adopted a font where _ was _ and not ← sometime around 2005, and you can still use _ for assignment IIRC.”

    and

    “I think the popularity of camelCase in the mainstream actually predates Java; it comes from C++ programmers aping Smalltalk.”

  3. Brian Marick Says:

    Oh, and this from Wikipedia:

    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.

  4. bl0rq Says:

    I don’t know where camel case came from, but I know why it’s better: one less keystroke.

  5. MarkKnell Says:

    Picking up where bl0rq left off, I’ll add that I prefer camelCase because I’m yet another QWERTY sucker. All things being equal, I try to avoid characters on the top row of the keyboard. Ruby’s a lovely language conceptually, but ergonomically, it’s fat on @, #, and _. The hyphen in -> isn’t winning it any points, either.

    I think a good 20% of the negative side of my ambivalence about Lisp comes from the parens. Not that one can hope to escape them in any language. And I don’t mind top-row characters in genuinely mathematical expressions. Math isn’t English, I’ve made my peace with that. But there comes a point when enough is plenty. It reminds me of a moment in Salinger (I’m thinking “Raise High the Roofbeams, Carpenter”, but the internets tell me it’s “Seymour — An Introduction”), when Buddy Glass writes, confessing and only half-apologizing for his deeply nested syntax, “I privately say to you, old friend, please accept from me this unpretentious bouquet of very early-blooming parentheses: (((( ))))”. Lisp and Salinger, two things from the sixties that I liked in my teens and twenties and have reservations about now.

    Returning to the OT, everyone loves languages that are readable, but let’s not forget about being able to type them, too. In fact, this extra keyboard workout may be the only sense in which Ruby is “strongly typed”. Heh.

Leave a Reply

You must be logged in to post a comment.