19 November 2013 / Last updated: 27 Jan 2017

JavaScript's Final Frontier

Execution time:
Disclaimer: For those that have a burning hatred (or lingering dislike) of JavaScript, this post will likely not be a good use of time. If you take away one thing, let it be this: This post is a retelling of JavaScript's history and a view to its future. There is a community of people out there that are very excited by it, and it's ok if you don't feel that way. There's enough room in the computing world for a thousand languages to bloom.
JavaScript started life as the Cinderella of the programming language family, squeezed somewhere between it's step-sisters, Flash and Java. Its initial, humble purpose was to add little imperative bits of functionality to largely declarative HTML websites. In fact, the way Douglas Crockford tells it, the only reason it survived its early days is because it offerred an easy way for Java to access the DOM and Netscape couldn't be bothered to code that bridge again. During the first Browser Wars it got pulled from side to side, while simultaneously getting no real respect from anyone. But it survived, and established a niche for itself.

A New Hope

Then, in the early 2000s, websites gave way to web "apps". AJAX was the new hotness, Web 2.0 the buzzword du jour, and people were surprised to find that the J in AJAX stood for JavaScript. That language no serious developer would admit to knowing well. The advent of JQuery proved that when the DOM API was peeled off it, JS was actually an allright kid to hang out with, if you kept clear of its bad parts
The browser was becoming interesting again, and Firefox was giving Internet Explorer a run for its money. One thing lead to another and the Browser Wars begun again, they had.
This arms race, with Firefox, Chrome, the rejuvenated Internet Explorer and Safari as the primary belligerents, brought JavaScript to new performance and ubiquity heights. When run on JIT compiler engines like V8, JavaScript isn't even an interpreted language anymore. Several, independent, well-funded, fully-compatible, standards-based implementations, startd a fight to improve JavaScript's performance, feature set, and gain market share. The only other language that can make similar claims is C/C++, and only to a point. Remember that whole "Write once, run anywhere" thing? Java claimed it, JavaScript actually went and did it.
From that point on, the floodgates broke open. Speed rocketed sky high, CommonJS and node.js brought JS to the server, PhoneGap to mobile phones, and in a move carefully orchestrated to give old-timers heart attacks, Heroku even allowed writing PostgreSQL stored procedures in JavaScript!
Jeff Atwood, aptly and with tongue set firmly in cheek, put it thus:
Any application that can be written in JavaScript, will eventually be written in JavaScript.
One might reasonably put these datapoints one next to the other and wonder: What's next? What's left for JavaScript to conquer? Is this the end of the era of explosive expansion?
Not. quite. yet.

Meanwhile in hardware-land

During this same period, computers have been, well, disintegrating. We've gone from one large desktop in people's living rooms, to several computers per person. We like to call them phones, tablets, laptops, ebook readers, among other things. JavaScript runs on all of these but the process of splintering hasn't stopped. Little devices like the Raspberry Pi and the Arduino show us that computers will continue getting smaller, getting cheaper, and getting everywhere. Ericsson has predicted 50 Billion Connected Devices by 2020. Choose your grain of salt, but that's 6.5 devices per man woman and child on the planet. Even Paul Graham has hinted at the coming hardware renaissance.
JavaScript, having conquered the hearts of early adopters and sporting a fantastically healthy ecosystem, has the best shot at becoming the language of first resort for the Internet of Things. If you squint, embedded devices are a bit like servers, in that they require direct access to hardware, and a bit like clients, in that users often interact with these devices. JavaScript's combination of HTML/CSS and Node.js solutions set the bar incredibly high for any challenger, and none can claim victory over JS in the general case.
Yes, certain things will continue being written in C, Go, Rust, D, C++, etc. No, JavaScript is not a systems language. Yes, for the tiniest of devices running V8 makes no sense. But as chips improve in performance and cost, the window of devices and applications that can afford to run JavaScript without much worry will keep expanding. Definitely, not everyone enjoys writing in JS, and it's not the zenith of programming language design. (That's CoffeeScript. Just kidding.) But its sheer ubiquity, and that massive ecosystem, rewards its users generously: In fun, efficiency, and profit.

Let's build it!

As a team of JS hackers exposed to the issues a large installation of embedded javascript faces, we're throwing our hat in the ring. To help web developers and JS hackers program the physical world, we're building Resin.io. It helps web developers code for embedded devices, without asking them to learn new tools, languages, or acquire devops skills.
Like Heroku, Resin.io believes pushing code should be as simple as 'git push resin master', but instead of targeting servers in amazon's data centres, Resin.io targets small devices that could be anywhere. It will help you during development on one device, and let you naturally transition to deploying to any number of devices when you're ready. Resin.io takes away DevOps considerations like VPNs, operating systems, cross-compilers, monitoring, network security, and so much more, leaving you to focus on things that bring value to your users: The application and the device.
While we may support other languages in the future, I hope this essay articulates why we feel JavaScript is the natural place to start.
If you feel what we feel, you can:
  • Join the JS on Devices movement, hack on devices, organise your local community.
  • Enter your email right below to get a Resin.io Beta invite when we're ready.
If you're wondering what use cases there are for small devices and JavaScript, watch this space. We're preparing a summary of what's currently out there that will blow your mind and get you hacking.
And of course, if you enjoyed this article, tell other hackers, follow us on Twitter, or come find us on our community chat.
by Alexandros MarinosFounder/CEO, balena

Share this post