A Brief History of JavaScript: From Netscape Communications to ECMAScript

A Brief History of JavaScript From Netscape Communications to ECMAScript

JavaScript is probably one of the most important programming languages today. Thanks to the development of the web, JavaScript has reached heights that it was not promised. In this article, we will look at the entire path of JavaScript from its creation to the present day and try to look into its future.

It All Started in the 90s

The events that resulted in JavaScript unfolded over a six-month period, from May to December 1995. Netscape Communications has been steadily making its way in the field of web technologies. Its Netscape Communicator browser successfully won back positions from NCSA Mosaic, the first popular web browser. Netscape was created by people who were involved in the development of Mosaic in the early 90s. Now, with money and independence, they had everything they needed to find ways to further develop web technologies. This was the impetus for the birth of JavaScript.

Marc Andreessen, founder of Netscape Communications and a former member of the Mosaic team, believed that the web should become more dynamic. Animations, user interaction, and other types of interactivity should become an integral part of the Internet of the future. The Web needed a lightweight scripting language that could work with the DOM, which in those days was not standardized. There was one “exception” that was a serious challenge at that time: this language should not have been intended for large developers and other people who were related to the engineering side of the issue. Java in those days was already actively developing and firmly occupied this niche. Thus, the new scripting language was intended for a completely different audience-designers. Obviously, the web was static, and HTML was quite young and easy to learn, even for those who had nothing to do with programming. Therefore, everything that was supposed to become part of the browser and make the web more dynamic should be as clear as possible for people far from programming. From this assumption, the idea of Mocha was born, which was to become the simplest, most dynamic and accessible scripting language.

And then Brendan Eich, the father of JavaScript, appears in our story. Eich was supposed to develop a “Scheme for the browser” for Netscape. Scheme is a dynamic, powerful and functional dialect of the Lisp programming language with the most simplified syntax. The Web needed something like this: easy to learn, dynamic, terse, and powerful. Eich did not miss the chance to work on what he liked, and joined the team.

The team was tasked with preparing a working prototype as soon as possible. Sun Microsystems was finishing work on its Java programming language, then called Oak, and Netscape Communications was already ready to sign a contract with the company to make Java available in its browser. So why did you need Mocha (the first name of JavaScript)? Why was it necessary to create a completely new programming language when there was a ready-made alternative? The fact is that Java was not intended for the audience that Mocha focused on-scriptwriters, amateurs, designers. Java was too big and fancy to fulfill this role. The basic idea was that Java should be intended for large developers and professional programmers, while Mocha should be used for small scripting tasks. In other words, Mocha was supposed to be a scripting companion for Java on a principle similar to how C/C++ and Visual Basic interact on the Windows platform.

Netscape engineers have begun a detailed study of Java. They even started developing their own Java virtual machine, but the project was quickly abandoned because it could not achieve perfect compatibility with the Sun Microsystems virtual machine.

The problem of choosing a language as soon as possible was more acute than ever. Possible candidates were Python, Tcl, and Scheme. Eich had to act quickly. Compared to its competitors, it had two advantages: the freedom to determine the set of necessary capabilities and direct communication with the customer. Unfortunately, there was also an obvious disadvantage: there was almost no time to make a huge number of important decisions. JavaScript, a. k.a. Mocha, was born in such conditions. Within a few weeks, a working prototype was prepared, which was then integrated into Netscape Communicator.

What was supposed to be the equivalent of Scheme for the browser, resulted in something completely different. Eich’s hand was driven by the need to close the deal with Sun and make Mocha a scripting companion for Java. The syntax was supposed to be as close to Java as possible. In addition, Java has inherited semantics for a large number of well-established idioms. So Mocha was nothing like Scheme at all. It looked like dynamic Java, with a hybrid of Scheme and Self hidden under the shell.

The Mocha prototype was integrated into Netscape Communicator in May 1995. After a very short period of time, it was renamed LiveScript, because at that moment the word live looked very attractive from the point of view of marketers. In December 1995, the deal between Netscape Communications and Sun was closed: Mocha / LiveScript was renamed JavaScript and presented as a scripting language for performing small client tasks in the browser, while Java was a full-fledged professional programming language for developing complex web components.

The first version of JavaScript laid down all the fundamental features that this language is famous for to this day. In particular, its object model and functional features were already present in the first version.

Various Implementations

When Sun and Netscape closed the deal, and Mocha/LiveScript was renamed JavaScript, a very important question arose: what will happen to the competitors? Although Netscape was gaining popularity, becoming the most used browser, Microsoft was actively developing Internet Explorer. From the very first days, JavaScript showed such amazing possibilities in terms of user interaction that rival browsers had no choice but to find ready-made solutions that were working implementations of JavaScript in the shortest possible time. At that time (and for quite a long time after that), web standards remained quite weak. So Microsoft developed its own JavaScript implementation, calling it JScript. By removing the word Java from the name, they were able to avoid possible problems with the owners of the trademark. However, JScript wasn’t just different in its name. Small differences in implementation — in particular, the approach to some DOM functions-left ripples that will be felt for many years to come. The battles for JavaScript were fought on many more fronts than titles and timelines, and many of the quirks of this language came about because of them. The first version of JScript appeared in Internet Explorer 3.0, which was released in August 1996.

The JavaScript implementation also got its own name in Netscape. The version released with Netscape Navigator 2.0 was known as Mocha. In the fall of 1996, Eich rewrote most of Mocha to deal with the technical flaws and shortcomings that arose as a result of the rush to develop. The new version was named SpiderMonkey. This name is still used today in the JavaScript engine of the Firefox browser, the grandson of Netscape Navigator.

For several years, JScript and SpiderMonkey were the only JavaScript engines. The features of both engines, which are not always compatible, have determined the vector of web development for the coming years.

Main Features of the Architecture

Despite the fact that JavaScript was born in a hurry, some powerful features were built into it from the very beginning. These features defined JavaScript as a language and allowed it to outgrow its own boundaries, despite all its quirks.

Although creating a syntax as close to Java as possible was not the main idea of JavaScript, the market made its own adjustments. Perhaps a different syntax would be more suitable for certain tasks, but thanks to the use of familiar syntax, JavaScript has easily gained popularity.

Compare this example written in Java:

public class Sample {
  public static void main(String[] args) {
    System.out.println("Hello world!");
 try {
    final MissileSilo silo = new MissileSilo("silo.weapons.mil");
    silo.launchMissile(args[0]);
 }  catch(Exception e) { 
    System.out.println("Unexpected exception: " + e);
  }
 }
}

with this example written in JavaScript:

   console.log('Hello world');
   try {
   const silo = new MissileSilo('silo.weapons.mil');
   silo.launchMissile(process.argv[0]);
 } catch(e) {
   console.log('Unexpected exception' + e);
 }

Functions as Objects

Functions in JavaScript are just another type of object. They can be operated on, as well as any other elements. They can be bound to variables and, in later versions of JavaScript, even thrown as exceptions. Most likely, this feature of JavaScript is due to Scheme.

var myFunction = function() {
 console.log('hello');
}
otherFunction(myFunction);
myFunction.property = '1';

Due to the fact that functions are considered as objects, various functional patterns have become possible:

var a = [1, 2, 3];
a.forEach(function(e) {
  console.log(e);
});

Prototype Programming

Although prototypical programming became popular thanks to JavaScript, it was first introduced in Self. Eich favored this particular style of programming, which proved powerful enough to model the more traditional approach of Simula-like languages such as Java or C++. By and large, the classes implemented in the modern version of JavaScript are nothing but syntactic sugar sprinkled on the prototype system.

The creators of Self, the programming language that inspired Eich to introduce prototypes to JavaScript, tried to avoid the problems associated with objects in Simula-like languages. In particular, branching between classes and instances has caused many of the problems inherent in Simula-like languages. We have repeatedly discussed the problem that arose when the program code developed and became larger: since classes were the archetype for all new objects, as the code grew, it became increasingly difficult to adapt the base classes to the new requirements that arose in the process. This problem can be avoided by making new instances of prototypes, from which, in turn, new objects would be created. This is the basic concept of prototypes: a sample that can be set its own parameters. If the prototype was not suitable for the new object, it could be cloned and modified without affecting any other child instances. In class-based languages, this approach is extremely difficult to implement.

ECMAScript: Standardized JavaScript

The first big change for JavaScript after its release was the standardization of ECMA. ECMA is an association established in 1961 to standardize information and communication systems.

Work on standardizing JavaScript began in November 1996. The standard that the TC-39 team was working on was assigned the ECMA-262 identification number. By that time, JavaScript was actively used on many web pages. This 1996 press release lists the number of 300,000 pages using JavaScript.

Standardization has become not only an important step for the young language, but also a serious challenge. It opened up JavaScript to a larger audience and allowed third-party developers to participate in the development of the language. She also helped keep other developers in line. At that time, there was a concern that Microsoft or anyone else might deviate too much from the original implementation of the language, which could lead to fragmentation.

Due to trademark issues, ECMA could not use JavaScript as the name. After a brief debate, it was decided that the programming language described by the standard would be called ECMAScript. Today, JavaScript is just a commercial name for ECMAScript.


.

Recommended Articles

Share
Tweet
Pin
Share
Share