2013-12-16

On December 4, 1995 a joint press release from Netscape Communications and Sun Microsystems announced the arrival of JavaScript. The language was backed by 28 industry-leading companies, although few of them survive to this day.

JavaScript was boldly described as “an open, cross-platform object scripting language for the creation and customization of applications on enterprise networks and the Internet.” The statement revealed:

The JavaScript language complements Java, Sun’s industry-leading object-oriented, cross-platform programming language.

JavaScript is analogous to Visual Basic in that it can be used by people with little or no programming experience to quickly construct complex applications.

Oh really?!

Brendan Eich’s quickly-designed language first shipped with the beta release of Netscape Navigator 2.0 in September 1995. The project was code-named Mocha and initially named LiveScript. The change to JavaScript coincided with Netscape adding Java applet support to the Navigator web browser:

JavaScript scripts are designed to run on both clients and servers modify the properties and behavior of Java objects.

This was a clever marketing ploy in 1995 when Java was heralded as the solution to all IT woes. The press statement confusingly implies that JavaScript is somehow linked with Java — which continues to cause confusion to this day. JavaScript was neither Java or a cut-down scripting language. To quote Jeremy Keith:

Java is to JavaScript as ham is to hamster.

Within one year, Microsoft had added JScript to Internet Explorer. The language was functionally identical — quirks and all — but named differently to avoid Sun trademark issues.

Despite the launch of Netscape Enterprise Server, classic ASP and several other systems, JavaScript struggled server-side. It never achieved the widespread success of PHP, .NET and Java itself. Node.js is starting to have an impact now, but it’s early days.

However, client-side JavaScript was an instant hit. In the days before CSS, simple browser functionality was difficult and sand-boxed Java applets could could not interact with the whole page. Before long, developers were adding simple form validators, calculators and animations.

The language had some early competition from Microsoft VBScript in Internet Explorer, but that never stood a chance while Netscape Navigator remained the top browser. (Strangely, VBScript was the most-used language in server-side ASP even though JScript could also be used.)

In November 1996, Netscape submitted JavaScript to ECMA International for consideration as an industry standard and the first edition of the ECMA-262 specification appeared shortly after.

Then came the dark ages.

JavaScript’s standing and usefulness was questioned during the first browser war at the end of the 1990s. Netscape and Microsoft implemented completely different browser models for what had been loosely named “Dynamic HTML” or DHTML. It was almost impossible to write a cross-browser application so many developers abandoned client-side development for the simpler server environment.

To be fair, the problems weren’t caused by JavaScript but the ludicrously incompatible browser APIs. If you think vendor relationships are stained now, Netscape and Microsoft were positively antagonistic. Netscape boasted that the OS was dead and all applications would be browser-based. While this may have been forward-thinking, the technology could not match the reality and quickly turned to vaporware. Microsoft retaliated by bundling IE free with Windows and severing Netscape’s revenue stream. The decision resulted in costly court cases and fines although it’s difficult to imagine any OS without a default browser now.

IE won the first browser war. Few users noticed the rival company skirmishes; IE was simply better than Netscape which, by version 4, was an atrocious piece of software. A single browser should have been good for JavaScript developers but IE’s development tools were basic to the point of being unusable. I still have nightmares about numerous “Object not an instance of an object at line 0″ errors. Microsoft then deserted browser development and the situation for JavaScript looked bleak.

Fortunately, JavaScript was re-born owing to a number of factors:

The emergence of Firefox (Phoenix) in 2002. Netscape open-sourced their browser code and started the Mozilla project in 1998. The old codebase was abandoned for the Gecko rendering engine which first appeared in the bloated, buggy and slow Mozilla Suite. Firefox was an experimental standalone browser which quickly became popular with developers because it was better than the aging IE6 and offered superior debugging tools which culminated in the revolutionary Firebug.

The rise of Ajax in 2005. XMLHttpRequest had been introduced by Microsoft in 1999 but few developers exploited it. Jesse James Garrett’s article Ajax: A New Approach to Web Applications gave us a cool buzzword which made us re-consider the possibilities.

Google Maps (2005) and Gmail (2004). Google was creating cutting-edge Ajax projects before the term was conceived. We now had a buzzword and some great examples to assess the potential.

The introduction of client-side libraries. Projects such as Prototype, script.aculo.us, Mootools and jQuery smoothed over browser inconsistencies and made development easier.

A re-evaluation of client-side development including books and videos from SitePoint and Douglas Crockford’s 2007 JavaScript: The Good Parts.

The exponential expansion of the web had already made JavaScript the most-used computer language ever devised. By the middle of the decade, developers were starting to realize it could be used for sophisticated web applications which were as good — if not better — than desktop alternatives.

Today, JavaScript is everywhere. The industry has made a massive investment in the language and it’s moved beyond the browser to server development (Node.js), OS development (Windows 8, Chrome and Firefox OS) and even embedded hardware controllers.

Despite this, JavaScript is misunderstood. The name and original Netscape press statement don’t help, but many developers continue to berate the language. If you’re coming from a C-based environment such as Java, C++ or C#, JavaScript looks syntactically familiar — but it’s not. It takes time to get into the JavaScript mindset and realize the potential and the simple elegance behind prototypal inheritance. The more you use it, the more you’ll love it.

So happy 18th birthday, JavaScript. Few of us expected you to reach this milestone — but I’m glad you did.

Can JavaScript survive another 18 years? Can anything supersede a language which has become so entrenched in web and desktop development?

The post JavaScript Comes of Age appeared first on SitePoint.

Show more