You are on page 1of 8

DEVOPEDIA (/)

TM

for developers. by developers.

(/)

P ROGRAMMING FOR IOT 



arjun (/user/arjun)

2630 DevCoins

arvindpdmn (/user/arvindpdmn)

466 DevCoins

2 authors have contributed to this article


Last updated by arvindpdmn (/user/arvindpdmn) on 23 Jul 2020
Created by arjun (/user/arjun) on 13 Jun 2018

SUMMARY
Programming for IoT is usually a polyglot (multiple languages)
e ort since the Internet-of-Things (IoT) is a system of inter-
related computing devices that are provided with unique
identi ers and the ability to transfer data over a network. The

choice of programming-language depends on the capability and


purpose of the device. IoT encompasses a variety of devices
including edge devices, gateways, and cloud servers. 

A selection of programming languages for IoT. Source:


Devopedia.  

MILESTONES

International T
Things.”

IBM releases v
Foundation pr

Damien Georg
that's optimize

Lars Bak and K


Internet of Thi

/
Microsoft open
cloud, arti cial


Team Kinoma
JavaScript
 on lo
supported by



Google makes
its Android Thi

Eclipse announ
to C code. It co

The Linux Fou

DISCUSSION
 What are the popular languages for IOT?
The most popular languages in IoT are Java, C, C++, Python,
Javascript, Node.js, Assembler, PHP, C#, Lua, R, Go, Ruby,
Swift and Rust in descending order of popularity. This is from a
2017 online survey co-sponsored by Eclipse IoT Working Group,
IEEE IoT, AGILE IoT and IoT Council in which 713 individuals
participated.  

Popular languages for IoT by device types. Source: Other languages include Parasail, Microsoft P, Eclipse Mita,
https://www.slideshare.net/IanSkerrett/iot-developer-survey-
2017   Kotlin, Dart, MicroPython, and B#. 

 Which languages are suitable for edge devices, gateways and cloud computing?
Edge Devices - These are constrained-resource embedded
systems. For very small devices (higher constraints), Assembly
and C are the languages of choice. A better processor and
more computing power on the device enables one to use C,
Python, Node.js, Java. The focus is to minimize instruction
count, and maximize execution speed and resource
management.

Gateways - Gateways manage communication and do

Popular languages for Edge, Gateway and Cloud . Source: analysis of data from many devices through several di erent
https://www.slideshare.net/IanSkerrett/iot-developer-survey-
2017  
/
buses. More languages can be run on these devices because of their increased computing power, including
C, C++, Java, Python, and Node.js.

Cloud - With the nearly unlimited computing capability that's available, frameworks like Apache
Hadoop and HiveQL can compute and process large IOT datasets. Statistical computing and visualization

can be done using languages like R or Julia. 



 What are the approaches used in IoT application development? 
Node-Centric Programming - Every aspect is programmed by the developer like communication 
between nodes, collection and analysis of sensor data, issuing commands to actuator nodes. Interaction
between devices is explicitly encoded. 

Database approach - Every node is considered part of a database and the developer can issue queries
to sensor nodes. Focus is on collection, aggregation and sending of data to the base station.

Macro programming - Abstractions are provided to specify high-level communication.

Model-driven development - Application development complexity is reduced by increasing the level of


abstraction and by describing the system using di erent system views. The vertical separation of concerns

(SOC) reduces app development complexity by separating platform-independent model (PIM) and
platform-speci c models (PSM). The horizontal separation of concerns separates di erent aspects of a
system.

 What are the features to consider when evaluating IoT programming frameworks?
The following features are relevant:

Scalability - Programming frameworks that support diverse programming patterns that are able to
perform load-balancing dynamically.

Concurrency - Real-time communication between millions of devices and applications mean millions of
concurrent connections. Thread locking is not e cient in such situations. 

Coordination - Programming language support for explicitly (control driven) or implicitly (data driven)
orchestrating the role of computing elements.

Heterogeneity - Programming framework gives guidance on how computations are mapped to the
computing elements.

Fault tolerance - Applications should be able to gracefully go from online to o ine state as networks
partition and heal their connections.

Light footprint - In terms of runtime overhead and in terms of programming e ort the framework
should be light.

Support for latency and sensitivity - In geographically distributed applications, pushing all
computations to the cloud is not ideal. The programming framework has to handle these requirements
dynamically. 

 What programming paradigms are suitable for IoT?


/
A programming paradigm is a way to classify the programming language based on its execution model. It
should be kept in mind that a particular language can below to more than one paradigm. The following
programming paradigms are suited for IoT:

Functional - Functional programming helps solve the challenges of scalability and concurrency. Its 
preference for immutability, function composition, avoiding side-e ects, less code, etc. avoid several IoT 
pitfalls. 


Data ow - Data ow programming emphasizes the movement of data. It models programs as a series 
of connections. Explicitly de ned inputs and outputs connect operations. An operation runs as soon as all 
of its inputs become valid. Data ow languages are inherently parallel and can work well in large
decentralized systems. 

Event-Driven - Event-driven programming (events triggered by sensors, connectivity, or time) is well


suited to IoT where devices spend most of their time in power-saving modes, wake up due to some event,
process data, send it out, and go back to sleep. 

 Are there any speci c requirements that the languages should satisfy to be used for IoT?
Developers can consider the following:

Languages that support Functional, Data ow, or Event-


driven programming.

Interpreted languages (Python) are slower than compiled


ones (C/C++/Rust/Go).  

Type safety, memory management, no null pointer


exceptions. Languages such as C and C++ use explicit pointers
Software Tool Chain: From Host to Microprocessor. Source: to reference memory. Incorrect pointer calculations can lead to
https://www.coursera.org/learn/iot/lecture/QRCsQ/lecture-2-
2-compilation-and-interpretation  
bu er overruns and memory access violations. 

Availability of GPIO libraries.

Libraries that support IoT protocols like Advanced Message Queuing Protocol (AMQP), Constrained
Application Protocol (CoAP), Extensible Messaging and Presence Protocol (XMPP), OASIS MQTT, or Very
Simple Control Protocol (VSCP). 

 Within languages, are there any speci c variants, modules or libraries that enables IOT?
In Python, "mraa" and "paho-mqtt" are useful for IoT. . MicroPython can be used on constrained

devices.

Java rst appeared in the 1990s for a resource-tight embedded environment, requiring minimum
computing power. Many of the Oracle Java ME Embedded APIs are targeted at the needs of embedded

systems.

Eclipse Mita is a new programming language designed to feel like modern programming languages in
the vein of TypeScript, Kotlin, and Go. It helps scale from prototypes to commercial IoT deployments by

transpiling to C code.
/
 Could you share some best practices for IoT developers?
Choose a programming framework that promotes design reuse, implementation reuse and validation reuse
in order to enhance software extensibility, exibility and portability. To make distributed IoT microservices

resilient, developers should be able to specify precise sequence of execution steps to be taken by compiled

code, regardless of the order in which asynchronous event messages are processed. 



 Could you list IDEs, debuggers and tools for IoT programming? 
IDEs and tools for IoT are many and we list some of them 
below: 

Eclipse IOT project (Kura) - This is a Java-based


development framework for IoT applications.

IDEs and Tools for IoT. Source: Eclipse, Intel, Arduino, Arduino IDE - This IDE includes support for the C and C++
Raspbian, OpenSCADA, PlatformIO  
programming languages for programmable microcontrollers.
It's a complete package with many examples and pre-loaded libraries.

Raspbian - This IDE comes with many packages and examples created speci cally for the Raspberry Pi
boards.

OpenSCADA - This project is a part of Eclipse IOT Industry Working Group along with Eclipse SCADA
(Supervisory Control and Data Acquisition). It provides several libraries, interface apps, and con guration
tools.

PlatformIO - This is a cross-platform IDE that supports over 400 embedded boards, and several
development platforms and frameworks.

Macchina.io - This is a toolkit for building embedded applications for IoT using POCO C++ libraries and
the V8 JavaScript engine. The core is implemented in C++. JavaScript is used for application development. It
enables dynamically extensible modular applications using the plug-in and services model similar to OSGi
in Java. 

SAMPLE CODE

C ASM JAVA PYTHON

/
/* Source : https://www.elprocus.com/basics-and-structure-of-embedded-c-program-with-examples-for-beginners/ */
/* A program to toggle P1.5 of 8051 microcontroller */
#include<reg51.h>

sbit a=p1^5;

void main()

{
unsigned int k; 
a = 0x00;
while(1) 
{
a=0xff; 
for(i=0;i<255;i++);
a=0x00; 
for(i=0;i<255;i++);
}
}

REFERENCES 

1. Carle, Andy. 2015. "Language Matters: JavaScript, from IoT Product Concept to Production." Things Conference. December 9. Accessed 2018-06-12.
(https://www.slideshare.net/Kinoma/language-matters-javascript-from-iot-product-concept-to-production) 
(https://web.archive.org/web/20200621014219/https://www.slideshare.net/Kinoma/language-matters-javascript-from-iot-product-concept-to-production)

2. Choudhury, Ambika. 2019. "10 Best Programming Languages To Learn In 2020 For IoT Development." Analytics India Magazine, November 17. Accessed 2020-07-23.
(https://analyticsindiamag.com/10-best-programming-languages-to-learn-in-2020-for-iot-development/)

3. Cleary, Corey. 2016. "Functional Programming as the Paradigm for IOT." June 12. Accessed 2018-06-11. (https://www.coreycleary.me/functional-programming-as-the-paradigm-
for-iot/)  (https://web.archive.org/web/20200621014208/https://www.coreycleary.me/functional-programming-as-the-paradigm-for-iot/)

4. Delgado, Rick. 2017. "Why Java is the Language of Choice for the Internet of Things (IoT)." KD Nuggets. May 1. Accessed 2018-06-10. (https://www.kdnuggets.com/2017/05/java-
language-choice-iot.html)  (https://web.archive.org/web/20200621014051/https://www.kdnuggets.com/2017/05/java-language-choice-iot.html)

5. GOTO. 2011. "Dart, a new programming language for structured web programming." GOTO Århus conference. October 10. Accessed 2018-06-11. (http://gotocon.com/aarhus-
2011/presentation/Opening%20Keynote:%20Dart,%20a%20new%20programming%20language%20for%20structured%20web%20programming) 
(https://web.archive.org/web/20200621014137/http://gotocon.com/aarhus-
2011/presentation/Opening%20Keynote:%20Dart,%20a%20new%20programming%20language%20for%20structured%20web%20programming)

6. GOTO. 2015. "GOTO 2015 - Internet of Programmable Things - Kasper Lund." Goto Conferences. October 21. Accessed 2018-06-11. (https://www.youtube.com/watch?
v=Hx2iGEAvZRk)  (https://web.archive.org/web/20200621014130/https://www.youtube.com/watch?v=Hx2iGEAvZRk)

7. Gaurav, Kumar. 2017. "Programming Internet of Things using Contiki and Cooja." Open Source For You. June 17. Accessed 2018-06-15
(https://opensourceforu.com/2017/06/programming-internet-things-using-contiki-cooja/) 
(https://web.archive.org/web/20200621014250/https://opensourceforu.com/2017/06/programming-internet-things-using-contiki-cooja/)

8. George, Damien. 2013. "Micro Python: Python for microcontrollers." Kickstarter. November 13. Accessed 2018-06-11. (https://www.kickstarter.com/projects/214379695/micro-
python-python-for-microcontrollers)  (https://web.archive.org/web/20200621014144/https://www.kickstarter.com/projects/214379695/micro-python-python-for-
microcontrollers)

9. Harris, Ian. 2017. “Lecture 2.2: Compilation and Interpretation”. Introduction to the Internet of Things and Embedded Systems. Accessed 2018-06-12.
(https://www.coursera.org/learn/iot/lecture/QRCsQ/lecture-2-2-compilation-and-interpretation)

10. Hoddie, Peter. 2018. "Moddable." GitHub. March 23. Accessed 2018-06-12. (https://github.com/Kinoma/kinomajs/issues/29#issuecomment-375689877) 
(https://web.archive.org/web/20200621014228/https://github.com/Kinoma/kinomajs/issues/29#issuecomment-375689877)

11. Intel. 2017. "Selecting Programming Languages for the IoT." Intel. March 20. Accessed 2018-06-10. (https://software.intel.com/en-us/articles/selecting-programming-languages-
for-the-iot )

12. Intersog. 2017. "12 Popular Programming Languages For IoT Development In 2017." Intersog, on Medium, February 22. Accessed 2020-07-23.
(https://medium.com/@Intersog/12-popular-programming-languages-for-iot-development-in-2017-b8bf6ab5aef3)

13. Kobielus, James. 2017. "How to write event-driven IoT microservices that don’t break." Infoworld. June 30. Accessed 2018-06-10.
(https://www.infoworld.com/article/3204571/application-development/how-to-write-event-driven-iot-microservices-that-dont-break.html)

14. Krill, Paul. 2017. "Microsoft's P language is aimed at where cloud, AI, and IoT meet." Infoworld. May 23. Accessed 2018-06-10.
(https://www.infoworld.com/article/3197852/application-development/microsofts-p-language-is-aimed-at-where-cloud-ai-and-iot-meet.html)

15. Krishnamurthy. 2016. "Chapter 5 Programming Frameworks for Internet of Things." Internet of Things: Principles and Paradigms by Elsevier Page 91-98. Accessed 2018-06-11.
(https://books.google.co.in/books?id=_k11CwAAQBAJ&printsec=frontcover)  (https://web.archive.org/web/20200621014200/https://books.google.co.in/books?
id=_k11CwAAQBAJ&printsec=frontcover)

16. Lardinois, Frederic. 2017. "Google makes Kotlin a rst-class language for writing Android apps." TechCrunch. May 18. Accessed 2018-06-11.
(https://techcrunch.com/2017/05/17/google-makes-kotlin-a- rst-class-language-for-writing-android-apps/)

17. Linux, Foundation. 2018. "The Linux Foundation Announces an Open Source Reference Hypervisor Project Designed for IoT Device Development." The Linux Foundation. March
13. Accessed 2018-06-10. (https://www.linuxfoundation.org/press-release/the-linux-foundation-announces-an-open-source-reference-hypervisor-project-designed-for-iot-
device-development/)

18. NI. 2007. "Why Data ow Programming Languages are Ideal for Programming Parallel Hardware." Multicore Programming Fundamentals Whitepaper Series. National Instruments
Corporation. November 1. Accessed 2018-06-11. (http://www.ni.com/white-paper/6098/en/)

19. O'Leary, Nick. 2013. "Version 0.2.0 released." Node Red. October 16. Accessed 2018-06-10. (https://nodered.org/blog/2013/10/16/version-0-2-0-released) 
(https://web.archive.org/web/20200621014124/https://nodered.org/blog/2013/10/16/version-0-2-0-released)
/
20. Patel, Pankesh. 2015. "Towards Application Development for Internet of Things." ABB Corporate Research, India. Slide 10 - 15. August 10. Accessed 2018-06-15.
(https://www.slideshare.net/pankeshlinux/towards-application-development-for-the-internet-of-things-51472400) 
(https://web.archive.org/web/20200621014242/https://www.slideshare.net/pankeshlinux/towards-application-development-for-the-internet-of-things-51472400)

21. Press, Gil. 2014. "A Very Short History Of The Internet Of Things." Forbes. June 18. Accessed 2018-06-10. (https://www.forbes.com/sites/gilpress/2014/06/18/a-very-short-history-
of-the-internet-of-things/)  (https://web.archive.org/web/20200621014105/https://www.forbes.com/sites/gilpress/2014/06/18/a-very-short-history-of-the-internet-of-things/)

22. Ritter, Simon. 2013. "Top Ten reasons for using Java in Embeded Apps." Java Magazine. January 1. Accessed 2018-06-10. (http://www.oracle.com/us/technologies/java/top10-
reasons-java-embedded-2247620.pdf) 
23. Saket. 2018. "5 Best Development Software(IDE) for Internet of Things (IOT) in 2018." January 14. Accessed 2018-06-13. (http://www.it4nextgen.com/best-development-software-
ide-internet-things-iot/)  (https://web.archive.org/web/20200621014235/http://www.it4nextgen.com/best-development-software-ide-internet-things-iot/) 
24. Sharma, Archana. 2016. "The Most Popular IoT Programming Languages Today." January 22. Accessed 2018-06-10. (https://www.linkedin.com/pulse/most-popular-iot- 
programming-languages-today-archana-sharma)  (https://web.archive.org/web/20200621014301/https://www.linkedin.com/pulse/most-popular-iot-programming-languages-
today-archana-sharma) 
25. Simone, Sergio De. 2016. "Microsoft Open-Sources P Language for Safe Async Event-Driven Programming." InfoQ. October 1. Accessed 2018-06-10.

(https://www.infoq.com/news/2016/10/microsoft-p-language-opensourced)  (https://web.archive.org/web/20200621014116/https://www.infoq.com/news/2016/10/microsoft-
p-language-opensourced)

26. Skerrett, Ian. 2017. "IoT Developer Survey 2017." Eclipse Foundation. April 18. Accessed 2018-06-11. (https://www.slideshare.net/IanSkerrett/iot-developer-survey-2017) 
(https://web.archive.org/web/20200621014153/https://www.slideshare.net/IanSkerrett/iot-developer-survey-2017)

27. Slant. 2018. "What are the best programming languages for IoT (Internet of Things)?" Accesed 2018-06-10. (https://www.slant.co/topics/7164/~programming-languages-for-iot-
internet-of-things)

28. Sola, Rajesh. 2017. "Open Source Software You can use for IoT Development." Open Source For You. September 20. Accessed 2018-06-15.
(https://opensourceforu.com/2017/03/open-source-software-can-use-iot-development/) 
(https://web.archive.org/web/20200621014307/https://opensourceforu.com/2017/03/open-source-software-can-use-iot-development/)

29. Vrat, Satya. 2017. "IoT with Python : Essential Packages." February 12. Accessed 2018-06-10. (https://www.element14.com/community/groups/internet-of-
things/blog/2017/02/17/iot-with-python-essential-packages)

30. Weichel, Christian. 2018. "Introducing Eclipse Mita - A Language for Embedded IoT." Eclipse Newsletter. March 1. Accessed 2018-06-10.
(https://www.eclipse.org/community/eclipse_newsletter/2018/march/mita.php) 
(https://web.archive.org/web/20200621014059/https://www.eclipse.org/community/eclipse_newsletter/2018/march/mita.php)

TAGS

 embedded (/site-map/browse-articles/embedded) languages (/site-map/browse-articles/languages)


iot (/site-map/browse-articles/iot)

SEE ALSO
IoT Protocols  (/site-map/add-article?title=IoT+Protocols)

IoT Operating Systems (/iot-operating-systems)

Programming Paradigms  (/site-map/add-article?title=Programming+Paradigms)

Data ow Programming 

MQTT (/mqtt)

Transpiler (/transpiler)

FURTHER READING 

1. Buyya, Rajkumar. 2016. Internet of Things: Principles and Paradigms. Morgan Kaufmann (Elsevier).

2. Soldatos, John. 2016. Building Blocks for IoT Analytics. River Publishers.

3. Beal, Jacob. 2015. Aggregate Programming for the Internet of Things. Computer.org

ARTICLE STATS
1466 1
Words Chats

2 12
Authors Edits
/
16 17643
Likes Hits

CITE AS
Devopedia. 2020. "Programming for IoT." Version 12, July 23. Accessed 2020-08-05. https://devopedia.org/programming-for-iot 
COPY CITATION 

ABOUT ( /SITE-INFO/ABOUT) FOUNDATION ( /SITE-INFO/FOUNDATION)



TERMS OF USE ( /SITE-INFO/ TERMS -OF-USE) TRUSTEES ( /SITE- 
PRIVACY POLICY ( /SITE-INFO/ TERMS -OF- INFO/FOUNDATION#TRUSTEES)

USE#PRIVACY-POLICY) DONATIONS ( /SITE-


INFO/FOUNDATION#DONATIONS)

MISSION ( /SITE-INFO/ABOUT#MISSION) EVENTS ( /SITE-MAP/EVENTS)

VALUES ( /SITE-INFO/ABOUT#VALUES) REPORT ISSUES

LICENSING ( /SITE-INFO/ABOUT#LICENSING) (HT TPS: //GITHUB.COM/DEVOPEDIAORG/ WEBAPP/ISSUES)

OPEN SOURCE CODE


(HT TPS: //GITHUB.COM/DEVOPEDIAORG)

(https://creativecommons.org/licenses/by-sa/4.0/)
 (https://www.facebook.com/Devopedia/)  (https://twitter.com/Devopedia)
 (https://www.reddit.com/r/Devopedia/)  (mailto:webadmin@devopedia.org)

You might also like