An Dong (@AnDong) is the author of this article. The original address: http://developer.telerik.com/…

As the technology world evolves, JavaScript evolves as well. In its first few years in the software world, JavaScript never thought about getting into the business of service applications, mobile applications, or robots. Today, with the development of JavaScript, the language has moved into new areas such as chatbots, virtual reality, and the Internet of Things.

In addition to breaking new ground, JavaScript is gaining ground in the ecosystem of server, mobile, and desktop applications. In this article, we’ll first review some of the predictions we made last year, and then look at what JavaScript will do outside the browser in 2017. Let’s take a look at JavaScript in a server-side application.

Node.js

Node.js is an open source runtime library for building server-side applications. This type of JavaScript code does not run in a browser. Over the past few years, Node has evolved from a popular technology framework among startups to a mainstream development technology used by companies of all sizes.

Node’s package management tool, NPM, is no longer a tool for hosting server-side application modules, but is transformed into a canonical tool for distributing JavaScript code. Perhaps the number of packages on NPM is the best indicator of where Node is headed. In last year’s forecast, we produced the chart below, which compares package management data in various languages and shows the advantage of NPM.

Number of modules on ModuleCounts.com as of December 2015

Over the past year, the growth of NPM shows no signs of slowing down. In fact, the number of NPM packages grew from 200,000 to about 350,000, forcing the entire Y-axis scale to adjust.

Number of packages counted by ModuleCounts.com as of December 2016

There are a number of factors behind this growth, one of which is the fact that many companies are using Node in their underlying services. This is in line with our prediction last year.

“In 2016, we can expect more companies to further adopt Node and its package management tool NPM. Microsoft, IBM, Intel, Progress and other large companies will continue to use Node because of its long-term support plans, replacing some of them. .NET, Java and other traditional enterprise solutions.”

Given Node’s growth, this is not surprising. Case studies of Node have shown that a handful of mid-sized companies are already using Node, including Netflix, GoDaddy, and Capital One.

Node is used in critical infrastructure, most notably at NASA. You can also take a look at NASA’s research on Node, which I’ve just excerpted here.

“A minor hiccup or interruption of service can be the difference between life and death when an astronaut’s life is at stake. From EVA data to astronauts in space, Node.js helps keep everything and everyone safe.”

But NASA isn’t the only one helping NODE grow. Node’s package management tool, NPM, has become a great choice for storing JavaScript code across environments, and the uniformity of package management tools has in turn helped propel Node.

In this article, each framework, each technology we discuss, uses NPM to store and distribute its source code. Search NPM for “jQuery”, “polymer”, “React”, “Cordova” or “NativeScript” and you get a sense of the size of NPM today. As JavaScript has grown in popularity, so has NPM. The more NPM becomes popular, the faster Node.js will grow. We believe this trend will continue for some time to come.

A search for “Angular” at npmjs.com yields nearly 10,000 results. Angular is one of many libraries distributed through NPM.

In 2017, we believe that more companies will switch from traditional development methods like Java and C# to Node. We believe TypeScript will also help drive Node’s growth because it is more friendly to Java and C# developers. Node’s commitment to support LTS versions will also help this trend, as it ensures that the versions used by these companies will continue to be supported and maintained for years to come.

In general, large companies don’t like to maintain multiple development systems and languages, and with Node, companies can integrate all of their development systems, not just server-side code, in a single language. Let’s take a look at how JavaScript affects mobile.

PhoneGap and Cordova

PhoneGap, and its foundation, Cordova, are JavaScript’s first forays into native development. Cordova encapsulates Web code in a WebView that drives native mobile applications. This approach allows Web developers to use the skills they already have (JavaScript) to develop mobile applications, which is why Cordova has been an important choice for developing mobile applications for many years.

But that is slowly beginning to change. Today, Cordova is challenged by many alternative solutions, most of which use Javascript based solutions similar to Cordova’s. Perhaps Cordova’s biggest challenge comes from google-led Progressive Web Apps (PWAS).

Google’s Progressive Web Apps home page

PWAS brings a lot of near-native features to the web world, such as push notifications, offline access, and home screen ICONS. Last year, we predicted that Google would slowly begin to implement the PWA approach. As it turns out, this prediction is conservative, as Google has made it clear that they will launch a variety of campaigns to promote PWAS. At the recent Chrome Developer Summit, as well as at this year’s Google I/O conference, Google scheduled a lot of discussion for PWAS.

PWAS is relevant to this discussion because it has begun to encroach on Cordova’s territory — Web applications that require native functionality. If your web application needs offline access or push notifications, PWA rather than Cordova is a better solution. While it’s hard to measure how many people choose PWAS for hybrid apps, there’s already plenty of evidence that Cordova’s use is shrinking. Here’s how many times a week people have downloaded Cordova in the last two years. As you can see, although Cordova downloads haven’t fluctuated as much, the increase has been less dramatic.

Weekly downloads of the “Cordova” NPM package from December 2014 to December 2016. (Data from npm-stat.com)

There is another reason for the decline. While we believe that PWA is eating into Cordova’s share, we also believe that newer development approaches in the mobile space are eating into Cordova’s share.

Native mobile apps

JavaScript-powered Native mobile apps, a concept pioneered by Appcelerator, have gained popularity with the help of Facebook’s React Native and Progress’s NativeScript. Native applications developed in JavaScript do not use WebView, so there is no need to consider the Web performance issues encountered by Cordova-based applications.

In last year’s discussion, we predicted that 2016 would be the year in which these frameworks would mature and be widely used, and those predictions appear to be accurate. Over the past two years, weekly downloads of React Native have continued to increase.

Weekly downloads of the “React-Native” NPM package from December 2014 to December 2016. (Data from npm-stat.com)

NativeScript has the same trend.

Weekly downloads of the “nativeScript” NPM package from December 2014 to December 2016. (Data from npm-stat.com)

It’s not just that the download numbers of these JavaScript driven Native frameworks are increasing. A recent survey (State of JavaScript 2016) shows that JavaScript developers are interested in both React Native and NativeScript.

Results of the State of JavaScript 2016 Interests in Mobile Development

These are the results of a survey and analysis of JavaScript.

“Cordova” and “PhoneGap” scored low on the interest score, perhaps due to their performance issues. While the mobile browsers and JavaScript engines that Cordova and PhoneGap rely on have improved a lot, they are still not as good as running Native code (like React Native).

In 2017, we expect these frameworks for building native apps in JavaScript to accelerate as more and more JavaScript developers try their hand at building native apps. React Native will benefit from the rapid growth of the React framework, and NativeScript will benefit from the completion of Angular 2 support announced in May, as well as the upgrade of many projects from Angular 1 to Angular 2. We also hope that the JavaScript-Driven Native Framework will appeal to native iOS and Android developers, as it allows you to build truly native apps on both platforms with a single piece of code.

JavaScript is increasingly encroaching on what was once a mobile realm dominated by languages like Objective-C and Java. But that’s not the only new area where JavaScript is making inroads. Next we’ll discuss moving to desktop applications.

A desktop application

Traditionally, if you were to build Windows or Mac applications, you would use platform-specific tools, such as WPF and Windows Forms, or a cross-platform solution, such as Java or Adobe AIR. However, as with the other software ecosystems discussed above, JavaScript-based solutions are encroaching on the field.

In last year’s discussion, we looked at the two most popular JavaScript frameworks for building desktop applications — NW.js and GitHub’s Electron — and predicted that their usage would increase significantly in 2016. From a practical point of view, growth has already occurred, and Electron has now become an important choice for developing JavaScript-based desktop applications.

If you compare the downloads of “Electron” and “NW” on NPM, you will see that the trend of “Electron” (red line) is similar to that of React Native, while the download curve of nw.js is relatively flat.

Weekly downloads of “Electron” and “NW” NPM packages from September to November 2016. (Data from npm-stat.com)

In December 2015, on GitHub, Electron has 20,000 stars and NW.js has 25,000. Today, Elecron has nearly 40,000 Stars, while NW.JS has just over 30,000.

Electron has also been accepted by mainstream desktop applications. The framework now provides support for Visual Studio Code. Visual Studio Code, provided by Microsoft, is a popular editor with more than five million users as of April. Electron has also been promoted by the React and Angular communities, so tutorials on using Electron in both frameworks can be easily found online.

We expect Electron to continue to dominate in 2017. We expect Electron to be more integrated with the most popular frameworks (primarily React and Angular) and to gain more attention from software vendors. And as JavaScript continues to make inroads into areas traditionally dominated by Java and Microsoft-based technologies, we hope Electron will continue to be used as an alternative to developments such as WPF, Java, and Adobe AIR.

The idea of using a single language for all your development needs is not only attractive, but also takes advantage of some of the latest developments in JavaScript. Finally, let’s look at JavaScript’s performance in some of the new software domains.

New frontiers of JavaScript

Ask analysts about developments in the developing world and the list of buzzwords they come up with is virtual reality, chatbots and the Internet of Things (IoT).

Of all the new technologies, JavaScript is by far the most important in the chatbot space, where people use it to develop bots ranging from simple Slack bots to sophisticated bots to conduct business transactions. In the chatbot space, most frameworks have integrated Node libraries into their SDKs, including BotKit, Microsoft’s Bot Framework, and Facebook’s Wit. ai. Microsoft’s documentation for the Bot framework even explains why Node is used to develop bots.

“The Node-based Bot Builder is a powerful framework for building bots that can handle various forms of interaction and give more guidance. It shows the possibilities clearly to the user. It uses frameworks (such as Express and Restify) that allow developers to build bots in a familiar way.”

Reusing JavaScript also provides Node APIs for many popular IoT libraries (such as Losant and Zetta) and devices such as Leap Motion. The Chrome team and the A-Frame team are examples of this, and quite A few teams are using JavaScript in virtual reality.

The Google Chrome team has an impressive array of virtual reality experiments, all built in JavaScript, that you can try out for yourself.

However, JavaScript doesn’t have much of an edge in areas where C ++, Python, and C # dominate. For example, the Oculus Rift mainly uses C ++, while Microsoft’s HoloLens requires you to write in C #.

We expect this trend to begin to change in 2017. As JavaScript grows in popularity and speeds up, JavaScript will continue to expand into areas like VR and the Internet of Things. With the emergence of new software development ecosystems, we expect JavaScript to quickly rise to first-class citizenship.

Tiger balm JavaScript

Ten years ago, using JavaScript on a server would have been unthinkable; Today, Node has 3.5 million users and is growing at 100% a year. Five years ago, using JavaScript to drive Native iOS or Android apps was just a spark. Today, NativeScript and React Native are growing at a phenomenal rate. Three years ago, it was rare to build desktop applications using JavaScript; today Electron downloads more than 10,000 times a month.

JavaScript will not be used for programming in all scenarios, because many other languages are better suited to solving specific scenarios. But regardless of the development platform, the widespread use of JavaScript is bound to be an important factor. One of Jeff Atwood’s most popular quotes on this topic is perhaps the best one to end with, since his speeches are always prophetic.

“Any application that can be written in JavaScript will eventually be written in JavaScript.”



IKCAMP’s original new book “Practical Efficient Development of Mobile Web Front-end” has been sold on Amazon, Jingdong and Dangdang.