[Viewpoint] reasons for learning Javascript

Source: Internet
Author: User
Tags riak

Guidance:ArticleAccording 《Why a javascript hater thinks everyone needs to learn Javascript in the next yearThis article is translated. Translated by Li songfeng 《Reasons for learning Javascript.

The content is as follows:

Javascript has been in my eyes for a long time.Programming LanguageSecond-class citizens. Early on, it was often the source of many security issues, just like glue. It sticks HTML applications and styles, but no one has written them in a regular way.ProgramSuch a situation is too common. Java, Ruby, and Python are the languages that can be used to compile programs.

Over the past few years, I have completely changed my attitude towards JavaScript. Javascript has grown up. I can assure that many JavaScript developers do not agree with what I mentioned earlier. They will say that JavaScript has always been a very powerful, mature, and deeply rooted language. Maybe they are right. In fact, as long as they are a complete programming language, they can write programs, including the abuse of basic. A language is really useful. On the one hand, it must have a strong ability to express itself, and on the other hand, it must have a large number of libraries and development tools. Obviously, the expression ability of JavaScript has long been okay. Even if the method of creating an object is a little unacceptable, it is not a problem. Until recently, some extremely important technologies to reverse the situation have emerged: jquery, JSON, node. JS, and HTML5. Javascript may have been a well-developed language before, but it is these important technologies (and others that are not mentioned here), making JavaScript a language that every developer knows. If you want to learn a new language next year, it must be JavaScript.

Unlimited Potential node. js

The infinite potential of node. js means that it may trigger a revolution in Web development. Node. JS is a framework used to build high-performance Web applications. Even massive requests can respond quickly and effectively. Although Node itself is an underlying framework that can be used to build any application, it is best suited to build Web servers. Its asynchronous event-driven model is undoubtedly more suitable for Web applications than the traditional request-response model.

There are two factors that make node look promising. First, Google has set off a revolution in improving JavaScript performance. This does not mean that you can use the best JavaScript Engine anytime, anywhere (although this is also a good expectation ). But it is certain that Google really regards JavaScript performance as one thing without the worry of other competitors. In this way, Mozilla, apple, Microsoft, opera, and other browser developers are forced to enter the performance competition runway. As a result, the JavaScript engine we are using is faster than a few years ago, and we don't know how many times it is. We have the ability to run complex large web applications.

Second, node has a huge developer base. No matter what language is used on the server, JavaScript is rarely used on the client. Some may be "scissors and paste", while others may use JavaScript to make superb Ajax applications, while some may even implement full-featured applications, like Twitter or gmail. However, the number of JavaScript developers is huge. Doug crockford and other authors strongly advocate that JavaScript should be treated as a serious programming language-although it still has many disadvantages.

At that time, writing a node application was still a rough job. After all, it was just an underlying library. Imagine writing in Javascript aloneCodeRight, that's the feeling that node is still a beta version and cannot be compared with a mature web development framework like rails or Django. This situation will undoubtedly change. Some lightweight frameworks, such as express, have emerged. I firmly believe that more node-based full-featured frameworks will also emerge.

We have mentioned some advanced Web applications that are almost completely running in browsers. Those are nothing new. How old is Gmail? Google Maps? However, the client that uses JavaScript to write applications running in a browser is undoubtedly becoming more and more attractive. HTML5 continues to push up expectations for this trend.

HTML5 is actually Javascript

I don't know how many times I have said. HTML5 is actually not much related to HTML. It is actually JavaScript. What changes does HTML have? But there are some new labels, and they are also easy to understand. HTML5 enables you to use JavaScript to create these tags. If there is no background code that uses canvas to create an animation or game, or use it to visualize some data, this label is useless. Starting with the support for canvas in the browser, I have seen hundreds of implementations of asteroids (planetary games), which are all exercises that developers are familiar with this new feature. Some are rough, while others are exquisite. All of these are thanks to JavaScript.

It can be seen that HTML5 is not a major improvement in the label language characterized by Angle brackets. Its essence is to give JavaScript more powerful capabilities. The webgl Library (currently not available) supports drawing real-time 3D images in the HTML5 canvas. The location-based service (lbs) Application-basic configuration of mobile phones can be implemented in the browser based on the geographical location of HTML5. The persistent storage and offline functions lay the foundation for full-featured applications running in browsers, which are comparable to those of desktop applications. At present, even the experimental library that adds multi-touch events has appeared. None of these are actually JavaScript features. HTML5 only provides a stage for these advanced functions.

In a further step, the HTML5 browser Library Development Library has also made great progress. For a long time, JavaScript has always been the best choice for implementing dynamic effects in HTML. Two problems can be solved: browser compatibility, and direct Dom operations are too troublesome. Jquery makes these two problems disappear without a trace. This library has become the basic configuration of modern browser-based client development. But not just jquery. Protovis and D3 allow you to directly create complex interactive data visualization effects in the browser. For the first time in history, the browser has become an important tool for displaying data.

JavaScript and databases, compilers and languages

Even JavaScript has been widely used in databases! Currently, couchdb, MongoDB, and Riak are the three leaders in nosql operation, all of which are "document databases ". They store documents instead of tables. The so-called "documents" of these databases are actually JSON documents, rather than word or Excel. (In addition to JSON documents, Riak also supports XML and plain text .) JSON has become a widely used data exchange format (almost all modern programming languages have JSON-parsed libraries, JSON is not actually a format for serializing JavaScript objects! Therefore, although you can use JSON in any language, it is natural to use it in Javascript development. Moreover, the JSON format has become a cross-language standard, rather than a serialized format in Python, Ruby, Java, and other languages. This fact is enough to show that JavaScript will play a role on a broader stage. Not only that, but the above three databases have built-in support for JavaScript queries. In the next few years, more people will be surprised to find that JavaScript and JSON have been built into other applications!

The beginning of the Javascript era has just begun. In JSCONF this year, a core topic is the JavaScript-to-JavaScript compiler, which is also seen as a major trend in the future. Google is a pioneer in compiling JavaScript code. As far as I know, GWT (Google Web Toolkit) should be the first framework to generate JavaScript code by compiling (from Java code. I didn't pay too much attention to GWT in the past. I just thought it was a framework dedicated to saving those Java programmers so that they don't have to spend time writing JavaScript. However, GWT has made so many optimizations to JavaScript during the compilation process, which is simply amazing. Closure is a "javascript-to-JavaScript compiler" that can achieve the same level of optimization. Traceur, a framework that came out a few weeks ago. It can be used to experiment with new JavaScript features, in other words, it can compile JavaScript code with experimental language features into JavaScript code that can be run on all modern platforms.

Finally, we also began to see the original JVM language boom under the Java flag: various languages are committed to compiling into JavaScript! Some of these languages are interesting, such as coffeescript and kaffeine. They are similar to Javascript in style, but they are more focused on making up for some of the imperfections in JavaScript. I think the object model of JavaScript is very interesting. How can I find it stupid? Is it daunting to think that a prototype-based actual object must be repeatedly defined? Coffeescript has made significant improvements. In addition to improving the object model, coffeescript also adds a new feature similar to list parsing (comprehensions), removing most of the curly braces. Just like in Python, indentation is used to differentiate code blocks.

Future Web servers, inexhaustible client libraries, HTML5, databases, and even JavaScript-based languages-I can see Javascript in my eyes! If you have been away with JavaScript, you should have learned it this year. There is no reason. Really, I don't want to learn any more. I'm afraid you have no chance to catch up with others any more!

Original article from:Radar. oreilly

Translated from:CN-cuckoo

Related Article

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.