What are the Ruby on Rails vs JavaScript pros and cons? Should JavaScript be used together with Ruby? Read on to learn more. Brendan Eich created JavaScript in while he was at Netscape Communications Corporation, the creators of the legendary Netscape Navigator web browser. At the time, the Java coding language was rapidly gaining traction and Netscape Communications was working to make it available in Netscape Communicator.
However, Java was too large and too complex to appeal to amateurs, scripters, and designers. In order to solve this problem, Netscape Communications contracted Brendan Eich to design a versatile programming language that could speed up web development and serve as a scripting companion for Java. And yet, instead of being just a Scheme for Netscape Navigator, JavaScript went on to become something much bigger.
The early versions of JavaScript were called Mocha. One of the design objectives of Self, the language that inspired JavaScript's prototypes, was to avoid the problems of Simula-style objects. In particular, the dichotomy between classes and instances was seen as the cause for many of the inherent problems in Simula's approach.
It was argued that as classes provided a certain archetype for object instances, as the code evolved and grew bigger, it was harder and harder to adapt those base classes to unexpected new requirements. By making instances the archetypes from which new objects could be constructed, this limitation was to be removed. Thus the concept of prototypes: an instance that fills in the gaps of a new instance by providing its own behavior.
If a prototype is deemed inapropiate for a new object, it can simply be cloned and modified without affecting all other child instances. This is arguably harder to do in a class-based approach i. The power of prototypes made JavaScript extremely flexible, sparking the development of many libraries with their own object models. A popular library called Stampit makes heavy use of the prototype system to extend and manipulate objects in ways that are not possible using a traditional class-based approach.
Perhaps one of the biggest mistakes in the hurried development of JavaScript was making certain objects that behave similarly have different types. For instance, the type of a string literal "Hello world" is not identical to the type of the String object new String 'Hello world'.
This sometimes enforces unnecessary and confusing typechecks. But this was just the start in JavaScript history. Its hurried development made certain design mistakes a possibility much too real. However, the advantages of having a language for the dynamic web could not be postponed, and history took over. The rest is perverse, merciless history. The first public release of JavaScript was integrated in Netscape Navigator 2.
Thanks to the wonders of virtualization and abandonware websites, we can revive those moments today! Unfortunately, many basic features of JavaScript were not working at the time. Anonymous functions and prototype chains, the two most powerful features were not working as they do today. Still, these features were already part of the design of the language and would be implemented correctly in the following years. It should be noted that the JavaScript interpreter in this release was considered in alpha state.
Fortunately, a year later, Netscape Navigator 3. Note how the error gives us more information about what is going on. This let's us speculate the interpreter is treating the prototype property in a special way.
So we attempt to replace the object with a basic Object instance which we then modify. Somewhat, at least. The assignment inside the test function appears to do nothing. Clearly, there was a lot of work that needed to be done. Nonetheless, JavaScript in its state was usable for many tasks and its popularity continued growing. Features such as regular expressions, JSON and exceptions were still not available. JavaScript would evolve tremendously the following years.
ECMA is an industry association formed in concerned solely with standardization of information and communications systems. Work on the standard for JavaScript was started in November By the time, JavaScript was already a popular element in many pages.
This press release from puts the number of JavaScript pages at , In the short time since their introduction last year, the new languages have seen rapid developer acceptance with more than , Java applets and more than , JavaScript-enabled pages on the Internet today according to www. Standardization was an important step for such a young language, but a great call nonetheless.
It opened up JavaScript to a wider audience, and gave other potential implementors voice in the evolution of the language. It also served the purpose of keeping other implementors in check. Back then, it was feared Microsoft or others would stray too far from the default implementation and cause fragmentation. The alternatives were not liked by many either, so after some discussion it was decided that the language described by the standard would be called ECMAScript.
It was working much better in the browser, however. JavaScript was becoming better and better. Version 1 was released in June Notice how our simple test of prototypes and functions now works correctly. A lot of work had gone under the hood in Netscape 4, and JavaScript benefited tremendously from it. Our example now essentially runs identically to any current browser. This is a great state to be for its first release as a standard.
It was released in June An interesting quirk of this version of JavaScript is that errors that are not caught at compile time which are in general left as unspecified leave to the whim of the interpreter what to do about them. This is because exceptions were not part of the language yet. This version brought in:. It was supported by all major browsers at the time, and continued to be supported many years later.
This made ECMAScript 3 the baseline target for many libraries, even when later versions of the standard where released. Although JavaScript was more in use than ever, it was still primarily a client-side language. Many of its new features brought it closer to breaking out of that cage. These browsers, alongside Internet Explorer continued pushing JavaScript growth. Although it was not part of the standard, Microsoft implemented certain extensions to JavaScript for its Internet Explorer 5 browser.
This function allowed a browser to perform an asynchronous HTTP request against a server, thus allowing pages to be updated on-the-fly. Although the term AJAX was not coined until years later, this technique was pretty much in place.
This evolution of features, an implementor bringing something interesting to the language and implementing it in its browser, is still the way JavaScript and associated web standards such as HTML and CSS continue to evolve. At the time, however, there was much less communication between parties, which resulted in delays and fragmentation. To be fair, JavaScript development today is much more organized, with procedures for presenting proposals by any interested parties.
This release supports exceptions, the main showstopper previous versions suffered when trying to access Google. Incredibly, trying to access Google in this version results in a viewable, working page, even today. For contrast we attempted to access Google using Netscape Navigator 4, and we got hit by the lack of exceptions, incomplete rendering, and bad layout. Things were moving fast for the web, even back then. Internet Explorer 5 was capable of rendering the current version of Google as well.
It is well known, however, there were many differences in the implementation of certain features between Internet Explorer and other browsers. These differences plagued the web for many years, and were the source of frustration for web developers for a long time, who usually had to implement special cases for Internet Explorer users.
Other browsers implemented it as a native object. Arguably, it was Internet Explorer 5 who brought the idea to the table first.
It was not until version 7 that Microsoft started to follow standards and consensus more closely. Some outdated corporate sites still require old versions of Internet Explorer to run correctly. Unfortunately, the following years were not good for JavaScript development.
There was a group of people that thought JavaScript needed features to become a stronger language for large-scale application development. This group proposed many features that were big in scope and in changes. Others thought this was not the appropriate course for JavaScript. The lack of consensus, and the complexity of some of the proposed features, pushed the release of ECMAScript 4 further and further away.
Many interesting features were discussed internally at Netscape. However, interest in implementing them had dwindled and work on a new version of ECMAScript stopped after a while in the year NET , used it as basis for their engines.
Years passed and the set of features grew bigger and bigger. Though flexible and formally powerful, the abstraction facilities of ES3 are often inadequate in practice for the development of large software systems. ECMAScript programs are becoming larger and more complex with the adoption of Ajax programming on the web and the extensive use of ECMAScript as an extension and scripting language in applications. The development of large programs can benefit substantially from facilities like static type checking, name hiding, early binding and other optimization hooks, and direct support for object-oriented programming, all of which are absent from ES3.
An interesting piece of history is the following Google Docs spreadsheet , which displays the state of implementation of several JavaScript engines and the discussion of the parties involved in that. Yahoo entered the game as most of the standard and features were already decided.
Doug Crockford, an influential JavaScript developer, was the person sent by Yahoo for this. He got strong support from the Microsoft representative. In the words of Crockford himself:.
But it turned out that the Microsoft member had similar concerns — he also thought the language was getting too big and was out of control. He had not said anything prior to my joining the group because he was concerned that, if Microsoft tried to get in the way of this thing, it would be accused of anti-competitive behavior.
Based on Microsoft's past performance, there were maybe some good reasons for them to be concerned about that — and it turned out, those concerns were well-founded, because that happened. But I convinced him that Microsoft should do the right thing, and to his credit, he decided that he should, and was able to convince Microsoft that it should. So Microsoft changed their position on ES4.
What started as doubts, soon became a strong stance against JavaScript. Microsoft refused to accept any part of ECMAScript 4 and was ready to take every necessary action to stop the standard from getting approved even legal actions. Fortunately, people in the committee managed to prevent a legal struggle. Some of the people at Microsoft wanted to play hardball on this thing, they wanted to start setting up paper trails, beginning grievance procedures, wanting to do these extra legal things.
I didn't want any part of that. The proponents of a scripting language offered the following explanation: [ 5 ]. To defend the idea of JavaScript against competing proposals, Netscape needed a prototype.
Eich wrote one in 10 days, in May Chapter 4.
0コメント