JavaScript - not just the language of the web

Even if you’re not a full time web developer, chances are you’ve at least dabbled with a bit of JavaScript, whether it is to help out a friend who is making a site, to expose some back end application you’re working on out to the web, or for just a bit of fun or interest.

JS has matured over the last handful of years - the days of being a niche language are behind us - and whilst some developers may chuckle at some of the JS “quirks” that still exist, many won’t doubt that it is a powerful language that is used widely to deliver critical applications in a variety of scenarios. Given it’s popularity and maturity, the question is, why not use JS for other things besides web applications? We’ve seen over the last few years with the increased popularity of nodejs that there is certainly a desire to use JS in other situations and the number of non-web related use cases is growing.

One such area is in building devices for the physical world. When I started in hardware it was C or nothing. There were a few people over in the Java world but for anything you built, the expectation was you’d build it in C. The arduino team did an excellent job of creating a library to make that process easier and abstract away some of the horrible parts of C that sat between creator and creating, however C was still the required method of production. Whilst other languages such as python and ruby have tried to become languages of the physical world too they haven’t done nearly as well as JS has. The main reason for this is simply scale -

there are more JS developers in the world than in all other languages combined.

Alongside this, most of these developers embrace the “culture” of the web - that is, to value openness, collaboration and transparency. This scale and culture coupled with the open hardware movement that has driven hardware production costs extremely low levels has created the perfect medium for experimentation and learning amongst this group. I transitioned into working with JavaScript and hardware in 2011 - initially by getting hardware to work with websockets in order to make interactive art installations that could be controlled from web applications.

At this point, the idea was very much considered a “joke” by the hardware community. After that, a small group of people around the world started collaborating to see how feasible it would be to build complex physical systems in JavaScript. By 2013 NodeBots had made an appearance at JSConf US and then the first NodeBots Day happened - where developers from around the world came together to tinker, learn and explore. At that first nodebots day there were many blinking LEDs and a few turning servos, there were plenty of bugs and a lot of software challenges but there were also many people who realised that you could build real physical things and control them from JS.

After these initial events, things have ramped up considerably. Hardware continued to get cheaper and more developers started showing interest. In 2015, International NodeBots Day attracted participants from nearly 50 cities in over 20 countries with well over a thousand developers taking part. Numerous side events are now taking place with specific focuses such as on the use of JS in IoT and how to build wearables using JS. Groups within the community are looking at ways to get JS closer to the hardware through the use of single board computers such as the Raspberry Pi and Intel Edison whilst others focus on leveraging new high powered chipsets such as the ARM Cortex that may be able to run JS natively in a VM.

Over the last few years I have watched this community evolve from a group of people sharing some code on GitHub and some pics on twitter to a truly global movement where thousands of developers and designers have built real-world physical things controlled from JavaScript. Web developers in particular love to make things it’s just that we tend to focus on the digital. Even our language speaks to this, where we talk about code as a “craft” as much as engineering and we “build” a site. It’s this aptitude and interest in building that is one of the key elements in why NodeBots and JS hardware is taking off. I have watched the satisfaction of someone who’s only experience of hardware is putting batteries into an object build a sensor that determines if the the coffee machine is free or in use.

I’ve seen students use a few cheap components to make interactive games that blend the notion of interface and controller between physical device and what is on screen. Then there were the 12 year old kids who convinced a parent to let them all skip school so they could come to a NodeBots workshop and build battlebots for the day. JS in the hardware world still has a long road to travel - there are still fundamental challenges needing to be fixed and so many bugs left to squash. However there is a groundswell in the web community that are starting to feel that in the world of connected hardware, maybe our talents in design, systems and human interaction are the natural custodians of these new devices we will be bringing into our lives. Certainly, a diversity of backgrounds beyond the traditional engineering skill set won’t hurt right?

Andrew Fisher is conducting a workshop on using JavaScript to program devices that can operate in the physical world but can talk to the Web. Complete details here.