When the king sleeps in town

Christian Sarnataro
Arduino Engineering
6 min readAug 9, 2022

It is said that the King of the Netherlands — when visiting Amsterdam — has a reserved wing at his disposal in the Royal Palace (which by the way is his property, he’s not illegally squatting). Today the palace is accessible to the public as a place of historical interest, however the King, for special events like official parties or ceremonies, can stay in his apartments at the Koninklijk Paleis.

Why am I talking about the King of the Netherlands in an engineering blog? Well, a few days ago, with a couple of Arduino colleagues, I attended a very interesting JavaScript conference in Amsterdam — JSNation.

Three Arduiners at JSNation 2022, in Amsterdam

During a guided tour of the city, our local guide told us that tram number 14 passes right under the windows of the King’s apartments. Since it would be very inconvenient to disturb the King with the rattling of carriages during his nap, the number 14 tram line is diverted whenever the King is in the palace. And people of Amsterdam know — or rather, they guess — that the King is in town whenever they see that their tram number 14 doesn’t stop at the usual stop.

Lateral knowledge

Sometimes knowledge comes to you in a “lateral” way. In other words, it is not necessary to have a sign outside the palace that reads “The King sleeps in town” to know that the King sleeps in town.

The same happens when you attend technical conferences. At JSNation we had the opportunity to hear dozens of talks from experts in various aspects of the JavaScript world. Some will talk about React, some about security in web development, some about functional programming, some about new features in the language itself.

However, in my opinion, the real value you take away from this kind of conference is the opportunity to think from a different perspective about your everyday professional challenges or problems. That exact same problem you solved using one approach could be solved in a different way, and very likely, with a different technology you didn’t know about, or that simply didn’t exist at the time. And as we all know, this happens very often in the JavaScript world, given the very high speed at which the ecosystem evolves.

This doesn’t mean all the talks at JSNation were “just inspirational,” some were indeed extremely technical and thorough. And I often found myself thinking: “oh, look, I could have done it this way…”

So, here are, in no particular order, some of the “lateral” takeaways I think I got during the conference:

  • Your stack, which you are very proud of because it is “modern”, may not necessarily be that modern anymore. New and better technologies come out every day, some of them focused on speed, some on performance, some on developer experience, or maybe focused on all of them.
    Just as a quick and fun recap, please, check out the Webberman song by Rich Harrys at https://youtu.be/RwBolXX9Pis?t=41. It will give you a sense of the journey a modern web developer has to take to be really modern. Please note: very likely it will be obsolete in 6 months :)
    Some technologies to consider
    - Edge computing
    - Deno
    - WebPack 5 and module federation
    - ESM and Vite.js
    - Upcoming: Immutable Data Structures in JS (records and tuples)
  • In the JavaScript world (i.e. leaving out for the moment other technologies such as PHP, Ruby, etc), React is no longer the only candidate to the throne of the King of Front-end. There are many competitors (maybe in specific niches), so developers would do well to familiarize themselves with:
    - Svelte
    - SolidJS
    - Vue
    (already very popular and mature)
    - Angular (the immortal)
    - And dozens of other frameworks that come out every month.
  • After a few years where client-side was the preferred approach for rendering web apps, now it seems that the pendulum is swinging back to server-side again.
    - React suspense and the like
    - Fastify (i.e. ExpressJS for the roaring ’20s of the 21st century)
    - Graphql
    - Next.js (React meta framework)
    - Nuxt.js (VueJS meta framework)
    - SvelteKit (Svelte meta framework)
    - SolidStart (guess what? SolidJS meta framework)
    - Fresh (Preact on Deno)
    Virtually every front-end framework has its own server side meta framework today.
  • Edge computing is defining new roles and new perspectives, server side development is gradually becoming more accessible even for front-end developers. See for example:
    - Cloudflare workers
    - Deno deploy
  • The term “modern browsers” today means, practically, all the browsers existing on the market. Virtually all of them support advanced CSS features, ESM modules, web components. Supporting IE11 is something not even worth considering. No business manager will ever ask you to do so, for any weird business reason. Pheeew, it took years, but we’re finally there.
  • Accessibility (in the broadest sense of the term) is something which must be a first-class citizen in web development (and actually it’s becoming a prominent topic).
  • The same is true for security. It’s not something to be addressed at the end of the development cycle, just by delegating responsability to security experts at the end of the project.

Arduino and JavaScript

Finally, some considerations on the apparently strange relationship between Arduino and JavaScript. During a talk titled “How I’ve Been Using JavaScript to Automate my House”, the speaker asked: “Any of you know Arduino”?

And the answer was this:

The JSNation audience, raising their hands when asked if they know Arduino.

Wonderful! The majority (if not all) of the attendees raised their hands. Everyone knew Arduino boards and the Arduino IDE. Probably many of them have an Arduino board (or some clone) at home, and probably they tinkered a bit with it. Also, almost everyone knew that Arduino boards are programmed in C++.

So what does JavaScript have to do with it?

Well, during the Q&A session, I asked the speaker: “Have you ever tried the Arduino IoT Cloud Platform in your projects?”

The answer was:

Tumbleweeds rolling in front of a spechless speaker

It turned out that very few knew that Arduino provides a Cloud platform where you can create and save your IoT projects, create dashboards accessible on mobile devices. You can easily send and store all of your data collected by the sensors on your board, and you can have different boards located in different places in sync with each other.

And here comes JavaScript: the Arduino Cloud has a very user-friendly web console which is “obviously” implemented in JavaScript, mostly with React, and a sprinkle of Angular for some legacy projects. We have a dedicated team in Arduino — the “IoTCloud” team — which is working specifically on the cloud platform, both on front-end (as mentioned, in JavaScript) and the backend, which is implemented mainly in Go.
There are a number of tutorials and videos online about the Arduino Cloud, primarily on the Arduino YouTube channel and on our Project Hub.
However I would like to point out this very interesting tutorial by an independent youtuber, DroneBot Workshop https://www.youtube.com/watch?v=UFCmTZUoZ1M.

In addition to that, the new desktop IDE v2 (available for free at https://www.arduino.cc/en/software) is implemented in JavaScript, using the Theia platform, Electron and React.

Finally it’s worth mentioning that a few browsers (namely, Google Chrome at the moment) can be directly integrated with Arduino boards via Bluetooth or Web Serial API. But this is a topic for an upcoming blog post.

Conclusions

The JavaScript landscape has changed so much in the last few years. Spaces where other programming languages were prominent (servers, IoT devices, even microcontrollers) have been invaded, and we’re really happy about this contamination. JavaScript, as a language, has its quirks, we all know that. But the ecosystem and the community behind it is so dynamic that an innovative company like Arduino cannot ignore it. It’s certain, today JavaScript can be fully considered part of Arduino’s ecosystem.

P.S. Thanks to my beloved colleagues Franceso Pirrotta, Luca Doglione and Dave Simpson for their contribution.

--

--