Be wary of Java and welcome JavaScript

Source: Internet
Author: User

It's natural for many developers to worry that Oracle has recently accused search giant Google of Dalvik virtual machines on its Android smartphone operating system that violate Java patents. But most analysts say the lawsuit will have little impact on the vast majority of Java developers, but some programmers are terrified that they are starting to look for an alternative language. If that's the case with you, have you ever considered turning to JavaScript?

What "And you may be surprised." Any developer or less knows that Java has little or no relation to JavaScript. Netscape originally wanted to call this cross-browser scripting language LiveScript, but Sun Microsystems persuaded them to use the name JavaScript-their idea was to think of JavaScript as A bridge between HTML and Sun's full-featured Java.

But if Sun ignores the existence of JavaScript and thinks Java will be the real language on the web, it's a big mistake. Java finally found its niche as a server-side language, and JavaScript gave it a deadly hit in the browser. Today, projects like COMMONJS and node. js extend JavaScript to a wider area, enabling it to act as a traditional Java role in the data center. In such a magical role conversion, JavaScript is becoming a versatile, powerful, full-featured web language, while Java is increasingly becoming the result of the former COBOL language.

Bridging client/server side

It is estimated that people who have experienced that era can recall the clumsy, ugly, and unattractive appearance of the browser-based Java applet, which brings more annoyance than real usefulness. Even though Sun's recent attempts at rich Internet application technology have--JAVAFX, it has not made it much more forward in the process of confronting its existing rivals, including Adobe Flash, Microsoft Silverlight. Client Java appears to have been sentenced to death on the day of birth.

Similarly, server-side JavaScript (SSJS) has never produced much spark. As early as 1996, Netscape Enterprise Server supported Ssjs, but it was an expensive and patented product. It was soon robbed by the open source Apache server, and Ssjs disappeared with it.

In those days, however, JavaScript did become the most lightweight scripting language for Web pages. Compare the other languages that were emerging in that period, such as Perl and Python,javascript, which run slowly and are syntactically weird, with limited functionality support. What's worse, each vendor's implementation is different, causing developers to waste time writing patches and related processing.

So far, JavaScript has gone a long way. The emergence of independent, open-source JavaScript engines-including Google's V8,mozilla SpiderMonkey, and WebKit's squirrelfish extreme-- means that anyone can embed a standard-compatible JavaScript interpreter in their code without having to develop them from scratch. Currently, these three projects are in a violent performance race, and each engine's performance is steadily progressing. As these low-level technologies develop at a high speed, JavaScript presents a situation that Java has never realized: breaking traditional domain barriers and connecting servers and clients. The client's Java has never been a boom, but the server-side JavaScript has killed it back.

Server-side JavaScript getting more and more attention

Modern JavaScript engines are capable of running independently of each other, which makes them a natural convenience for SSJS. But at the moment JavaScript is still primarily a browser-side language, which makes it less functional in other environments than some developers expect. For example, the developer of a client usually loads a separate. js file over the Internet, and the server-side developer needs a more common way to make the code program into a package. Similarly, JavaScript lacks a common standard library of system functionality, and more system-oriented languages like C and Java are much richer in this regard.

The COMMONJS project is trying to solve these problems. Its goal is to create a set of open, standard APIs, such as binary object processing, parallel threading, file, stream, and socket I/O, System log processing and other functional interfaces. In addition, it proposes a set of code and module format standards for the associated namespaces. While this is a very young project, its ultimate goal is to have JavaScript developers have a COMMONJS specification when writing code that can be run on any COMMONJS compatible platform without any modifications--- No matter what the underlying JavaScript engine and operating system are.

However, the more exciting is the node. JS project, which is similar to Commonjs's original intention and implements some Commonjs APIs. However, it has lifted the concept of SSJS to a new height. One of its most important innovations is the implementation of an event-oriented programming model for server-side development. This means that not only nodo.js programming will make the client's JavaScript developers feel comfortable-because the event-driven model is their development specification, but also the ideal choice for Web applications that rely heavily on parallel operations to support multiple concurrent users.

If this sounds like a hand summoned to you, take a look at the node. JS Programming Example. This completely equivalent of the "hello,world! "The program is a full HTTP server-side implementation that uses only 6 lines of JavaScript code.

The King of Javascript:web?

Don't expect JavaScript to pull Java off the throne. COMMONJS and node. JS have a lot of homework to do, and a precise description of the two items should be: the test. For more improvements, such as specific optimizations and management tools, such as Oracle's work with the JRockit JVM will make Java an attractive platform for enterprise software development.

However, the benefits of JavaScript as a server-side development language are obvious. It enables web developers to implement all programs in a single syntax, removing confusion and confusion in typical Web applications. JavaScript's efficiency improvements are changing, which is what developers value most. The JavaScript language itself has matured to become a good language, with features that support both object-oriented and functional programming styles.

There is another point to note: JavaScript is completely free and open, and it is maintained by the ECMA Standards Committee, which is comprised of industry vendors. The ECMAScript Working Group was in a state of stagnation, but it has overcome the difficulties that have enabled JavaScript to continue to develop at a high speed. At the same time, Java, while pretending to be open, has a nondescript JCP (Java Community Process) in charge, while being threatened by Oracle's potential lawsuits. If Oracle is not aware of the current situation, I am sure the developers are clearly looking at it.

Be wary of Java and welcome JavaScript

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.