5 Tips for Selecting your Embedded Application Programming Language

Developers should try, learn, and test new languages. Yet for long-term product development, it’s best to choose a language that is standardized, well understood, and will be maintained for years to come.

Jacob Beningo

March 2, 2020

5 Min Read
5 Tips for Selecting your Embedded Application Programming Language

Selecting a programming language for an embedded application used to be easy. Developers simply went with C or if they were a bit adventurous, they might choose C++ and invoke a heated debate amongst colleagues who felt that C++ was dangerous, inefficient and so on (an argument which still rages today although not nearly as much as half a decade ago). The last couple of years have provided developers with alternative options, with languages such as Python, Rust, Java and several scripting languages becoming options for developers. In this post, we are going to look at 5 tips for selecting the programming language that best your development needs. 

download_20_0.jpg

Don’t rule out any new language, but carefully evaluate whether it truly makes sense to use it in your development cycle. (Source: Jacob Beningo)

Tip #1 – Consider Real-time Performance

When it comes to embedded systems, real-time performance is critical, whether that performance is soft real-time or hard real-time, deadlines need to be met. Real-time performance seems like a strange characteristic to consider given that performance is not strictly tied to language but several factors. However, if you think about the performance you can get from a system that is developed properly in assembly, versus one that is developed in C/C++ versus one written in Python, you’ll find that assembly would probably win every time. Obviously using assembly would be nightmare so you trade-off some performance for being able to write more maintainable and portable code.

Tip #2 – Select Languages that are Standardized and Evolve Slowly

Using the latest and trending language can be a great way to get attention, but the problem with many languages that have targeted embedded systems over the last 50 years is that they are short lived and have been unable to usurp C. They are just a fad that quickly gives way to some other language. When developing a product, if that product will be in production or the code will be reused for 5 years or more, using a standardized language may make a lot more sense. New languages often either are not yet standardized and evolve at a rapid rate. For example, Python is well defined, but the techniques and libraries available within any embedded target is often less than the standard set and constantly changing, making it a much lesser subset of the whole language which is evolving faster than the subsets can keep up with. Standardization and evolution are important to consider when selecting your language.

Tip #3 – Select a Language that is Understood by the Team

I often run across development teams where a single, strong willed developer, was able to convince their colleagues that a specific framework, OS or language should be used. It’s often something that is cutting edge and an area of interest for the developer. The team reluctantly gets onboard and then 6 months or a year down the road, after significant progress has been made, the primary developers leaves. The development team is left with code that they don’t fully understand, struggle to learn and a small nightmare ensues for half a decade or more. The moral of this little story is that it’s important to select a language that the whole team is onboard with and where it is easy to find developers in the labor pool for in order to minimize not just headaches, but development costs and schedules.

Tip #4 – Review the Language Runtime Requirements

All languages are not created equal. For example, if you were to write an application in C that blinks an LED, you could easily write the code to initialize the processor, GPIO peripheral, timer and main function in less than two kilobytes of code space. If a developer were to write that same program in Python, the code for the application might be fewer lines of code or more elegant, but the code space required for the Python interpreter and supporting libraries could easily be over 300 kilobytes of space! For a simple application, using a higher-level language that has larger runtime requirements probably doesn’t make sense. Then again, on a more complex IoT device, it may make a lot more sense. The developer has to look at what they are doing and evaluate the runtime requirements and see how it fits within their overall project needs.

Tip #5 – Select a Language with a Strong Community

Finally, I believe it is important to look at the community around the programming language. Obviously programming languages such as C and C++ have strong communities around them and lots of example code. Languages like Python also have a very strong community and places developers can go in order to learn and ask questions. Languages like Rust are interesting because they have a growing community, but it may be still too early to determine if it will last over the long-term.  

Conclusions

There are a lot of exciting things happening in embedded system programming languages right now, with more options appearing every day. Developers should be proactive in trying, learning and testing new languages, but it is important that for any long-term product development developers select a language that is standardized, well understood and will be maintained for years to come. Don’t rule out any new languages, but carefully evaluate whether it truly makes sense to use them in your development cycle, or whether you want to use them simply because it’s cool and different.

RELATED ARTICLES:

 Jacob Beningo is an embedded software consultant who currently works with clients in more than a dozen countries to dramatically transform their businesses by improving product quality, cost and time to market. He has published more than 200 articles on embedded software development techniques, is a sought-after speaker and technical trainer, and holds three degrees which include a Masters of Engineering from the University of Michigan. Feel free to contact him at [email protected], at his website, and sign-up for his monthly Embedded Bytes Newsletter.

About the Author(s)

Jacob Beningo

Jacob Beningo is an embedded software consultant who currently works with clients in more than a dozen countries to dramatically transform their businesses by improving product quality, cost and time to market. He has published more than 300 articles on embedded software development techniques, has published several books, is a sought-after speaker and technical trainer and holds three degrees which include a Masters of Engineering from the University of Michigan.

Sign up for the Design News Daily newsletter.

You May Also Like