The Programming Language Of The Future Has Been Around For 20 years

So why do I want to talk about JavaScript? Because it’s awesome, and even more so right now.

So what is JavaScript? It is  the programming language of the web-browser, the layer that adds logic and interactivity to webpages. It first came into existence two decades ago, as an addition to the second version of Netscape Navigator. Famously throw together by a single developer in just ten days, the language was even renamed at the last minute from LiveScript, to cash in on the excitement about the recent launch of Java (and causing no end of confusion to recruitment consultants ever since).

So JavaScript hung around for a long time, but was never that powerful and not really used for much more than adding rollover effects to buttons and launching embedded Flash movies. But then, over the past ten years, several things happened that combined to transform JavaScript from a useful oddity to become one of the most widely adopted programming languages in the world.

First of all, Firefox and Chrome came along and transformed the browser landscape offering processing power and security not previously imaginable in the world of Internet Explorer. Suddenly web-browsers could provide rich, responsive experiences to the users, without the need for plugins. Which was just as well, as with Apple almost singlehandedly killing Flash by refusing to support it on iPhone or iPad, and Java rapidly becoming a securityhole nightmare, users no longer wanted to have to install plugins on their web-browsers.

You probably already know all of this, and are wondering when this is going to get interesting. Okay -  here we go: I can control a quadcopter with my mind. Using JavaScript. See, now it’s getting interesting. You see (thanks to a new platform called Node.js), JavaScript’s not just about the web-browser anymore. We can use it to write mobile apps (both iOS and Android), games and desktop applications. It can be used as a server-side language, instead of using PHP, .net, Java, etc — the same language running on both the front and back-ends, sharing the same libraries and data formats, seamlessly. And, as I alluded to, you can use it to integrate with hardware. Almost anything that can be connected to a computer, can be controlled with JavaScript now — toy robots, smartwatches, webcams, Raspberry Pis, the Nest thermostat and yes, quadcopters.

At Realise, we wanted to try this out for ourselves and see if the hype was real. So we got our hands on a quadcopter that can be controlled over Wi-Fi. Then we acquired an EEG headset (a series of sensors that sit on the skin and pick up high-level emotions such as happiness, concentration) which can be communicated with over Bluetooth. Using a few open-source libraries, and a little of our own code, we soon had the two devices communicating. The resulting experience: A brave volunteer/test subject wears the EEG headset, and if they can concentrate enough, the quadcopter takes off. The longer they can retain a high level of focus, the higher the quadcopter will climb till finally performing a back-flip in the air.


So controlling a quadcopter with just your mind — that’s pretty cool. But it’s not very… internet-y. Next, we decided to put aside the EEG headset and wrote a simple web-service that listens on Twitter for certain keywords (yes, like Twitter spam-bots) and made the quadcopter react to those instead. Now the person controlling the quadcopter didn’t even need to be in the same room as it. We tested this with the quadcopter active in our Edinburgh boardroom, but being controlled by someone Tweeting from the London office, and watching the results over Skype. Trust me, this experience was both thrilling and terrifying.

So what is the moral of this story (apart from Skynet seeming closer than ever)? Everything I described has been previously possible, with other tools and programming languages – but not nearly as easily. The explosion of JavaScript has given us a common platform, with a thriving community, making it simpler and faster than ever to build unique experiences and tie together different technologies in new and very, very exciting ways. Not bad for the same language used to validate registration forms.