Write Once, Run Everywhere: Journey to JavaScript

Written by Chris Hale, Senior Software Engineer

Cross-platform technologies allow developers to write an app once and run it on many different platforms, saving significant time, money, and effort. Developing cross-platform also makes an app easier to maintain, test, and debug. Despite these benefits, many businesses have chosen not to adopt cross-platform technologies and instead limit the number of supported platforms, or hire separate teams to build their iOS, Android, Windows, Mac, Linux, and web applications. This, in my opinion, is because of the perceived downsides of previous technologies like Java Swing and Adobe Air.


However, the development landscape has changed significantly in the last few years with new technologies, driven by JavaScript, offering solutions to the problems that plagued cross-platform technologies in the past. In this article we will look at a few of the key problems that prevented widespread adoption of Java Swing and Adobe Air, and examine JavaScript as the ideal next-generation solution.


Java Swing


The first well-known cross platform technology was Swing, introduced by the team behind Java in the 1990s. Swing gave engineers a common framework to develop a single UI application that could run on Windows, Mac, Linux, and the web while maintaining visual consistency. However, developing with Swing came with some challenges.


Swing applications required a specific Java version to run. If an end user did not have the correct version installed, the app would not run. Versions were easier for developers to control, but the average user often ran into issues both identifying and downloading the correct version. If a user had multiple Swing applications, each may require a different Java version, which further complicated the process of accessing them. Additionally, Swing’s UI component library was limited. It didn’t allow for many platform-specific customizations, either.


Adobe Air


In the late 2000s, Adobe created a programming language called ActionScript for Flash, then leveraged Flash’s popularity for web animation into a cross-platform framework, Adobe Air. With Adobe Air, developers who were already accustomed to building websites in Flash could translate these skills to build new, non-web platforms. Like Swing, however, Adobe Air was not without its faults.


The entire Adobe Air platform was closed source, which doomed it from the start. This made it difficult for Adobe to remain competitive with faster-moving, open-source technologies, like CSS animations. Additionally, inherent security flaws in Flash eventually led Adobe to abandon Flash in favor of HTML5. Currently, Adobe is transitioning ownership of Adobe Air to HARMAN, which, in my opinion, further calls into question the future of the technology.


Modern Cross-Platform with JavaScript


JavaScript is currently one of the most popular cross-platform development languages because it solves many of the problems inherent in previous technologies. Not only can it be used to build web, mobile, and desktop apps, it can also be used to create command line interfaces and backend APIs. Unlike Swing, JavaScript allows developers to more closely mimic a native experience through platform-by-platform customizations instead of attempting to unify the UI across platforms. And unlike Adobe Air, JavaScript and the associated tools are open source, which is one of the reasons the list of tools and libraries that can be used across platforms is large and growing.


The following are a few of these tools and libraries that are most popular:


Desktop

  • Electron
  • React Native
  • NW.js

Mobile

  • React Native
  • Apache Cordova

Web

  • React
  • Vue

Servers and CLI

  • Node.js

Each tool or library can have its own requirements, patterns, and structure, so the process of piecing together a single project can be complex. This is one of the drawbacks to developing cross-platform with JavaScript.


---
To learn more about leveraging some of the tools and libraries listed above, check out the other articles posted on FullStack’s blog.

Let’s Talk!

We’d love to learn more about your project. Contact us below for a free consultation with our CEO.
Projects start at $25,000.

FullStack Labs
This field is required
This field is required
Type of project
Reason for contact:
How did you hear about us? This field is required