Every day, there are more devices everywhere connected to the Internet, waiting patiently for our commands. How can we order them around? Which language do they speak?
The simple answer is that “smart” things use many of the same languages as desktops, in part because their similarities with desktop computers continue to grow. “A Raspberry Pi is an actual computer now,” said Ian Skerrett, the vice president of marketing for the Eclipse Foundation.
That’s not much different from the top languages used for writing old desktop apps and servers. But while the simple answer is that smart things aren’t much different from desktops and servers, the complex answer is that there are important differences between all of the things that make up the IoT.
What we mean when we say ‘IoT devices’
Skerrett divides the IoT architectural environment into three major sections: the sensors that create the data, the hubs or local gateways that organize it, and the geographically distant, centralized servers that collect the data.
“If you’re writing for a sensor on bare metal, you’re probably using C,” said Skerrett. The ability to work directly with the RAM makes C one of the first choices of hardware developers.
The rest of the machines in the chain, though, are as familiar as desktop computers, from the developer’s perspective. Thus, developers are able to use the language that’s familiar to them.
The hubs may be a smartphone or a small console, but they are just general-purpose machines inside. They usually run a standard operating system and often feel no different from a big machine, at least when communicating via the command line.
Choosing a language for IoT
There’s no reason why they can’t choose the language in the same way they do for a desktop project. If a Raspberry Pi is running Linux, it’s behavior is not that different from a desktop.
By the time the debate on languages makes its way to the servers, there’s no difference there, either. They speak with the hubs and sensors—usually with some kind of microservice architecture—then the data is pushed into standard databases.
While the usual suspects of popular languages dominate the IoT space already, the Eclipse survey found at least 14 different languages that were mentioned by 5 percent or more of the developers.
“Our Internet of Things effort at Eclipse is polyglot,” said Skerrett. “It’s not one language.”
Here are some of the top choices that are being used to build the foundations of the next generation of things connected to the Internet.
The top choice of the Eclipse survey and another survey by embedded-computing.com was Java, a result that’s not surprising for a language still known for being “write once, run anywhere.” The original project was aimed at set-top boxes, one of the first domains for non-desktop computing.
Java’s advantages are well known. Developers can create and debug code on their desktop and then move it to any chip with a Java Virtual Machine. That means the code can run not just on places where JVMs are common (servers and smartphones), but also on the smallest machines.