Programming languages in the IoT era

Beatriz Sanz Baños    4 January, 2017

Under each machine, every connection, any kind of interface… there is a programming language. IoT connects a myriad of devices to each other, creating a massive, complex network. But there are thousands and thousands of programming languages, too. Which is the most commonly used in the development of IoT? The choice of one language over another determines the end product or service, as well as the technical possibilities or the user experience. In the age of Internet of Things, choosing the programming language properly is vital to the success of the project.

Choosing one among thousands

One of the most critical points when understanding the role of different programming languages in development projects is to understand what reasons lead us to choose them. Traditionally, there are two fundamental questions when choosing a programming language: the end user and the device with which you are working. The former determines the end experience that you want to achieve while the latter describes the technical possibilities you have.

There are hundreds of thousands of devices connected to IoT. But what do we consider a device within the Internet of Things? According to the definition of Ian Skerrett, Marketing Director at the Eclipse Foundation, the architecture environment in IoT devices is divided into three main types: sensors that create the information, local hubs or gateways that organize it, and servers that store it, usually remotely.

This definition also helps us to understand why there is a need to choose between programming languages. When you work with a sensor, which measures or creates the data, you could choose a language like C, which is able to work directly with the RAM, for example. But to develop any of the other links in the chain, you may prefer to choose other more multiplatform-oriented languages, or simply one that is more familiar to you than others.

Java, C and JavaScript, the kings of the hill

Over the past year, the Eclipse IoT Working Group conducted an interesting survey of 592 developers within the IoT world. One of the intentions of the study was to probe the developers’ opinion regarding the use of programming languages ​​in their projects. The Eclipse data points to Java, C and JavaScript as the most often chosen and highly valued languages, with a notable difference compared to the others. Although Python and C ++ also rank strongly, the advantages of the first three continue to stand out.

These are the languages that are ​​generally preferred for the development of almost any project, where they recurrently appear because of their versatility, their availability in different platforms or their efficiency. However, when asked, several experts in the industry also mentioned other languages ​​such as SWIFT, Ruby, Lua or even assemble language. This matches the Eclipse survey, where these other languages were also chosen among the thousands options.

However, the choice of Java seems to spark some controversy. Beyond the document drafted by Eclipse, many experts usually opt for C as the main language, especially in IoT. Its role as the starting point of many other languages makes it a very convenient tool to master. C is used in embedded devices, which places it in a privileged position on the Internet. This language is used in the lower layers of the software, as close to the hardware as possible. C is flat, sober and very powerful, perfect for controlling any element in IoT.

On the other hand, in recent years Java has gained ground at the expense of C, especially when we talk about Internet of Things. The premise “write once, run everywhere” is a point that no developer underestimates. Its incredible multiplatform versatility coupled with the current possibility of embedding Java on any chip with JVM are the main reasons why it is chosen. So why there is any debate at all? The consumption of resources is the main reason why Java is not used more often. Despite the security and versatility this language offers, its consumption is the main limiting factor. It really determines most of its uses.

Finally, JavaScript is gaining importance in servers. Collecting and managing information through hubs and gateways is trending. Nowadays we can see JavaScript and Node.js running on large machines or microcontrollers right from the very start. JavaScript allows developers to programme in a familiar environment, without the need to learn new languages, which is making a difference. However, although it is gaining in importance within IoT-related needs, its use is still quite limited.

Scenario of emerging languages

“Internet of Things is a polyglot; it does not speak just a single language,” explained Skerrett when talking about Eclipse’s efforts. The results of the survey, in fact, support this statement. After all, there is no single choice. In fact, it is not even necessary to choose. IoT is an environment with the same technical possibilities as any other within computing. The choice of one programming language over another is due to multiple factors. This means a scenario where languages ​​that are not so commonly chosen are gradually emerging. Many of them are quite familiar to developers, while others are carving a niche for themselves thanks to the needs of the Internet of Things ecosystem.

Python is a “veteran” which began as a scripting language but is increasingly used as the main tool by developers. Python is the preferred language for one of the most popular microcontrollers on the market, “Raspberry Pi.” Many schools use this platform to teach programming, and manuals are easily accessible. Likewise, if the project is relatively simple and there are no large resource demands, it is possible to develop powerful tools easily thanks to this language.

Although Swift is mainly used to develop applications for iOS and MacOS, its presence in IoT solutions is indisputable. If you need an App or service to interact with an iPhone or iPad, both of which are incredibly widespread in the market, you need Swift. But in addition, Apple’s effort to make its devices the center of the home automation network is making Swift increasingly prominent. In this case, the Apple HomeKit platform plays a crucial role in Swift’s growing interest within IoT.

PHP is the most common choice among bloggers and web developers. But it is also surprisingly popular on IoT. Its role in servers is widely known, but it is being used at lower levels, too. Its simplicity is also a major benefit when using this language instead of other “heavyweights” like C. In addition, it is now easy to find languages ​​like C#, C++, Lua, Ruby or Go, among others. The future of IoT is clearly a scenario in which many languages ​​work together to interconnect a growing network of devices and services, a network in which there is no one main language.

Leave a Reply

Your email address will not be published.