2011-03-23

JavaScript: how it all began

This post presents a brief history of how Brendan Eich created JavaScript and what influenced its design decisions.

A company called Netscape was founded in 1994 and created one of the first web browsers. They recruited Eich in 1995, because they wanted him to create a programming language for that web browser. The lure for him was that he would be able to base the language on Scheme (a Lisp dialect). Scheme’s influence led to JavaScript having closures. Another influence was the prototype-based programming language Self which is responsible for JavaScript’s prototypal inheritance (some of the elegance of this approach is hidden by JavaScript’s muddled adoption of it). Next, Java got included in the browser. It quickly gained popularity and influenced Netscape’s decisions regarding JavaScript. For example, its name:

Question by interviewer: As I understand it, JavaScript started out as Mocha, then became LiveScript and then became JavaScript when Netscape and Sun got together. But it actually has nothing to do with Java or not much to do with it, correct?

Eich’s answer: That’s right. It was all within six months from May till December (1995) that it was Mocha and then LiveScript. And then in early December, Netscape and Sun did a license agreement and it became JavaScript. [2]

Eich explained why Netscape thought two languages were needed, instead of just Java, and why JavaScript is embedded in HTML.
We aimed to provide a “glue language” for the Web designers and part time programmers who were building Web content from components such as images, plugins, and Java applets. We saw Java as the “component language” used by higher-priced programmers, where the glue programmers – the Web page designers – would assemble components and automate their interactions using JS. [3]
Netscape management also decided that JavaScript’s syntax had to look like Java’s. That ruled out adopting existing scripting languages such as Perl, Python, TCL and Scheme.

Eich blames some of JavaScript’s idiosynchracies on having had to finish a prototype quickly, which subsequently was changed little before being deployed. His favorite JavaScript features [4] are:

  • First-class functions
  • Closures
  • Prototypes
  • Object literals and array literals
Sources of this post:
  1. Brendan’s Roadmap Updates: Popularity
  2. JavaScript creator ponders past, future
  3. The A-Z of Programming Languages: JavaScript
  4. A Brief History of JavaScript
Related post:

No comments: