Connected devices are now everywhere – from your smartphone, to your fridge, to home assistants like Amazon Echo and Google Home. The Internet of Things (IoT) will combine the power of voice recognition, artificial intelligence, and machine learning to make the next big revolution in tech happen. It is not about controlling home devices using voice commands anymore, it is about vast IoT networks that will have computing power greatly exceeding anything we have had in the past.
The global Internet of Things endpoint spending is forecast to exceed $3 trillion by 2020, when billions of connected devices will be installed in homes, vehicles, and industrial facilities. All those IoT devices must be programmed to connect and communicate securely with various networks, perform advanced tasks, and take advantage of AI or machine learning. That is why stakes are high on what programming language is to drive the IoT revolution.
Looking at the most popular IoT languages
Researchers and software developers don’t stop debating which is the best language for IoT. Nonetheless, there is a broad consensus on a number of languages that are most suitable for programming intelligent connected devices. Let’s take a look at the contenders:
- Assembler
- B#
- C
- C++
- Go
- Java
- JavaScript
- Lua
- Node.js
- Parasail
- PHP
- Python
- Ruby
- Rust
- Swift
Each of these languages has different capabilities, while many of them are more or less specialized. On the other hand, IoT is a relatively new space for software developers and researchers, who haven’t been involved in programming of industrial equipment before the IoT entered the consumer market. Thus, narrowly specialised languages are not the answer to the challenges posed by IoT anymore. What is needed is a general-purpose language that is able to power standardised devices across a variety of applications.
According to the survey by Eclipse Foundation, some 46 percent of corporations are deploying or prototyping IoT solutions using accessible hardware platforms such as Raspberry PI, Arduino, or Beaglebone. The most popular languages for these implementations are:
- Java
- JavaScript
- C
- C++
- Python
- Swift
From popular to best
The C language and its extended later modification C++ are among the first programming languages for general purposes, and their popularity among IoT programmers is understandably high.
The C language does not require a vast processing power and is suitable for low-level programming. Processing power is crucial for IoT programming because many of the IoT devices currently do not feature powerful processors. C, however, is rather prone to mistakes due to its complex punctuation where a small typo can ruin the code.
Python supports embedded programming and is consideredto be more flexible, with less rules and requirements. Nonetheless, Python has a long way to go before becoming suitable for general IoT purposes partly because it requires much more computational power from a device.
In comparison, Java is the most popular programming language among developers working on IoT projects. Nearly 52 percent of the developers surveyed by the Eclipse Foundation say they use Java to build IoT solutions.While delivering Java development services, Itransiton, for example, have found that Java is suitable for a wide variety of projects ranging from collaboration to document and content management to retail to portal websites.
Java can cope with those processing power challenges while being more portable than C++. Furthermore, many more software developers are familiar with the lightweight Java as compared to professionals working with C, which is crucial for implementing IoT projects at a large scale. Java can power devices with lots of calculations requiring intensive interfaces. In addition, a developer can create a code that will run seamlessly anywhere.
Using Java Virtual Machine for IoT
You must use a low-level language to run code directly on your hardware. Most firmware is created this way. Alternatively, you can use a high-level programming language that will slow down the entire system and be prone to crashes. The Java Virtual Machine, or JVM, is what it name implies – a virtual machine to run applications, including connected devices having less computing power.
Once a Java code is written, it can effectively run on any device where JVM is implemented, which eliminates the issue of compatibility in a globally connected ecosystem with billions of devices. Furthermore, virtualization results in fewer crashes due to software failures and prevents data loss or data corruption in case of malfunction.That is why software developers prefer the JVM platform for creating stable and relatively secure applications able to run on any device.
In fact, you can use dozens of programming languages to write code for JVM. This Oracle article lists Scala, Groovy, Clojure, Kotlin, Ceylon, Xtend, Fantom, and X10 as Java alternatives for JVM. Nonetheless, Java is the language of choice for over 90 percent of over 2,000 developers who responded to thesurvey by ZeroTurnaroud.
These results are not surprising at all, bearing in mind that since 2014 Oracle has been developing Java 8 and Java 9 as platforms for Internet of Things. Three years ago, Oracle’s Vice President of the Java business unit Scott Armour predicted that gateways, not data centres, would process most of the IoT data in the future where IoT applications will use APIs to share data with other apps. He also points out that portability of Java across devices is another factor to fuel the emergence of Java as a mainstream IoT platform.
Why Java wins
We are witnessing the ever-increasingimplementation of IoT applications since 2014. Most of these implementations are running on Java or use JVM as their platform. You can bet that Java is more for smartphones or tablets but Java also powers the smallest chips available across a variety of connected devices. Java’s micro edition, or Java ME, is taking advantage of a limited set of class libraries to save space on small embedded devices, for example.
Descending from the languages like C, Java is by far the most popular choice for consumer IoT devices. Oracle’s Java Embedded platform, for example, enables development of applications for future generations of connected cars and other industrial uses where vast amounts of data are processed. Unlike other programming languages, Java does not depend so much on the hardware you are programming while Java code is portable. Java’s hardware support libraries enable Java code to take control over a device by accessing the generic code, which is a mandatory functionality for any viable IoT solution.
Standardization in the field of IoT is very much a thing of the future,as long as various IoT platforms and language emerge on a daily basis. Given the current state of the IoT ecosystem, however, you can safely select Java as the most appropriate platform for your IoT project.