Languages JavaScript JavaScript in 2017: Beyond the Browser

JavaScript in 2017: Beyond the Browser

As technology evolves, so does JavaScript.

By TJ VanToll, Principal Developer Advocate at Progress.

 

IntroductionIntroduction

 

As the technology world evolves, so too does JavaScript. Previously, this meant that JavaScript was included in software worlds that it was never originally intended for, like server-side apps, mobile apps, and robots. Today, JavaScript’s growth has brought the language to chatbots, virtual reality, the Internet of Things (IoT), and beyond!

 

Slide 1: The Rise of Node.jsSlide 1: The Rise of Node.js

 

npm module counts from modulecounts.com as of December 2016. npm’s growth from ~200,000 to ~350,000 packages forced the Module Counts site to reconfigure the chart’s y axis.

First, let’s look at JavaScript in app development with Node.js. Node.js is an open source runtime library for building both server-side apps as well as small bits of JavaScript code needed to run outside of a browser environment. In just the past few years, Node has gone from niche technology to a mainstream development approach used by companies of all sizes.

Node’s package manager, npm, has transformed from hosting utility modules for server-side apps to canonical storage for distributable JavaScript code. Likely the best indication of Node’s rise is the number of packages stored on npm. From December 2015 to December 2016, npm has grown from approximately 200,000 to 350,000 packages! npm has become the de facto choice to store JavaScript code across all environments, and that consolidation on a single package manager helps drive Node’s adoption. As JavaScript grows in popularity, npm grows in popularity, and as npm grows in popularity, Node.js does too.

 

Slide 2: NASA Adopts NodeSlide 2: NASA Adopts Node

 

Image from the NASA Node.js case study.

The increase in Node.js can be attributed in part to the growing number of enterprises using Node in their infrastructure. Netflix, GoDaddy, and Capital One are a few of these businesses, but perhaps the most renowned Node critical infrastructure use case is NASA’s.

Here’s a telling excerpt from the Node.js case study: “When you’ve got the safety of astronauts on the line, little hiccups and service interruptions turn into life-and-death situations. From EVA [extra vehicular activity] data to astronauts up in space, Node.js helps ensure there’s a safe home for everything and everyone.”

 

Slide 3: Node in 2017Slide 3: Node in 2017

 

Image from Node.js infographic.

2017 will see more companies switch from traditional development approaches like Java and C# to Node. For one, Microsoft-written TypeScript will help drive Node’s growth, with features that make JavaScript a more approachable language for Java and C# developers. Plus, Node’s promise to long-term support releases also will contribute to its growth because it gives companies a guarantee that the version in use will be continually supported. Although large enterprises don’t like to maintain multiple development systems and languages, Node will allow these organizations to consolidate on a single language for their development.

 

Slide 4: Cordova and PhoneGapSlide 4: Cordova and PhoneGap

 

A WebView like the one Cordova uses is a chromeless browser window that’s typically configured to run full screen. The basic architecture can be understood in this infographic, comparing native, hybrid, and Web apps. Image courtesy of myShadesOfGray.

JavaScript is affecting the mobile world as well. Let’s consider Cordova, the open source framework PhoneGap is built on. PhoneGap and Cordova were JavaScript’s first foray into the world of native mobile development.

Essentially, Cordova’s basic approach is to wrap Web code in a WebView and use that to drive a native mobile app. This approach allows Web developers to build mobile apps with skills that they already have (namely JavaScript) and, because of that, Cordova has been a compelling option for building mobile apps for many years.

 

Slide 5: Cordova versus PWAsSlide 5: Cordova versus PWAs

 

Google’s home page for Progressive Web Apps.

Today, Cordova is being challenged by alternative development approaches, most of which leverage the same JavaScript-based skillset for which Cordova development is known. Cordova’s biggest challenger is likely the Google-led concept of Progressive Web Apps, or PWAs.

PWAs bring many native-like features to the Web, like push notifications, offline access, and home screen icons. In the last year, Google has made it clear that it’s committed to the PWA approach, as evidenced in the Chrome Developer Summit, which featured an extraordinary number of talks focusing on PWAs, which also was the case at the Google I/O conference.

PWAs eat into the primary Cordova apps use case: Web apps that need some native functionality. PWA is a compelling alternative when developers are building a Web app that needs offline access or push notifications—so compelling that Cordova usage is sharply declining. But, PWAs are not the only factor in Cordova’s decline—there’s a relatively new entry in the mobile world that’s also taking market share…

 

Slide 6: React Native, NativeScript, and JavaScript-driven AppsSlide 6: React Native, NativeScript, and JavaScript-driven Apps

 

Weekly downloads of the “react-native” npm package from December 2014 until December 2016. Data from npm-stat.com.

Pioneered by Appcelerator, the concept of a JavaScript-driven native app was popularized by a few new entries in the space, but chiefly by React Native from Facebook and by NativeScript by Progress. JavaScript-powered native apps don’t use a WebView, so they don’t have the same Web-based performance issues of Cordova-based applications. Thanks to its ongoing maturation, there has been a notable increase in React Native’s widespread use over the past several years.

 

Slide 7: JavaScript RisingSlide 7: JavaScript Rising

 

Survey results from the State of JavaScript 2016 survey on interest in mobile development approaches.

It’s not just the number of downloads that are up for React Native, NativeScript, and other JavaScript-driven native frameworks. The State of JavaScript 2016 survey showed that JavaScript developers are highly interested in React Native, as well as burgeoning interest in NativeScript. The survey analyzes this growth:

“Cordova and PhoneGap (which are basically the same thing) have much lower interest ratings, and it makes you wonder if people are turned off by the performance issues you sometimes hear about. With Cordova and PhoneGap, you rely on the underlying phone browser and its JavaScript engine to do the heavy lifting, which is often slower than running native code like React Native.”

In 2017, the growth of these JavaScript-driven native frameworks is set to accelerate as more JavaScript developers look to build mobile apps. Also, expect JavaScript-driven native frameworks to attract native iOS and Android developers, due to the fact that JavaScript-driven native frameworks let developers build truly native apps from a single codebase.

 

Slide 8: Electron for Desktop App DevelopmentSlide 8: Electron for Desktop App Development

 

Weekly downloads of the “electron” and “nw” npm packages from September 2016 to November 2016. Data from npm-stat.com.

Desktop applications constitute another new territory for growing JavaScript usage. Traditionally, building a Windows or Mac app required platform-specific tools or cross-platform interfaces. Now, JavaScript-based solutions are working their way into the picture.

In the past year, use of GitHub’s Electron has grown dramatically, and it’s now the de facto choice for JavaScript-based desktop app development. In December 2015, Electron had 20,000 GitHub stars—today, it has over 45,000 stars! The Electron framework now powers Visual Studio Code from Microsoft, which is used on average by more than half a million users. Electron’s dominance shows no signs of diminishing in 2017.

 

Slide 9: JavaScript's New FrontiersSlide 9: JavaScript’s New Frontiers

 

The Google Chrome team maintains an impressive set of JavaScript-built virtual reality experiments that you can try for yourself.

There’s a strong appeal in using a single language for all development needs. This is taking JavaScript to brave new software worlds like chatbots, virtual reality and the Internet of Things (IoT).

Of these, JavaScript is the most relevant in the chatbot ecosystem. Here, developers use it to build everything from simple Slack bots to more complex bots for industry use. Most frameworks in the chatbot world include Node libraries in their SDKs, including Botkit, Microsoft’s Bot Framework, and Facebook’s wit.ai. Microsoft’s Bot Framework’s documentation includes this quote on why to build bots with Node: “Bot Builder for Node.js is a powerful framework for constructing bots that can handle both freeform interactions and more guided ones where the possibilities are explicitly shown to the user. It is easy to use and models frameworks like Express & Restify to provide developers with a familiar way to write Bots.”

That desire to reuse JavaScript skills has led popular IoT libraries like Losant and zetta to offer Node APIs, as well devices such as the Leap Motion. There is also nascent interest in using JavaScript in virtual reality environments, led by the Google Chrome team as well as the A-Frame framework.

 

Slide 10: Does JavaScript Have Limits?Slide 10: Does JavaScript Have Limits?

 

Image courtesy of Progress.

JavaScript is still a niche player in many fields, among more prominent players such as C++, Python, and C#. But, JavaScript will break out of the niche mold before long. As it gains popularity, and as its speed continues to rise, the language will continue to find inroads into environments like virtual reality and the IoT.

As new software development ecosystems pop up, JavaScript will increasingly be included as a first-class citizen. Consider: 10 years ago using JavaScript on the server was unthinkable, but today Node has 3.5 million users and an annual growth rate of 100%. Five years ago, using JavaScript to drive a native iOS or Android app was a niche, but today React Native and NativeScript are growing at staggering rates. Three years ago, using JavaScript to build desktop apps was rare, but today Electron is downloaded over 100,000 times each month.

Yes, JavaScript will never be used for all programming, because many other languages are better suited to solve certain problems and use cases, but its widespread usage ensures it will always be a factor. Jeff Atwood’s famous quote on the topic now seems more prophetic than ever: “[A]ny application that can be written in JavaScript, will eventually be written in JavaScript.”

Latest Posts

Related Stories