Would it be fair to say that the GraalVM is a step closer to the holy grail of polyglot programming? Yes, according to the virtual machine experts from MicroDoc. Here’s an overview of what the GraalVM can do for software developers.

It was designed to be the programming interface of the future for the Oracle database, and therefore much effort and vast resources have been put into the development of the Graal virtual machine.

According to MicroDoc’s managing director Dr. Christian Kuka this ensures not only an array of interesting features that will make life easier for developers and project managers. On top of that, you can consider GraalVM to be future proof. As part of the Oracle database product it has a life cycle is 10+ years.

Speaking all languages

– The polyglot features of the GraalVM give you a whole range of advantages. It can execute software written in different languages in the same controlled environment. It allows you to run Java code and everything that is based on Java byte-code, including Kotlin, Scala etc. It also provides a runtime for Python, Ruby, and JavaScript and has the ability to host C, C++ and even Rust code.

– This allows for easy integrating of machine learning, neural networks and deep learning applications into your usual business applications. Most of the KI algorithms are written in Python, but currently, if you want to integrate them into some kind of mainstream software-product, you have to rewrite them in Java or C/C++ to use them in your code. So, normally you would have one developer write the prototype application in Python and another rewrite it in whatever language is running on the target platform/device. With GraalVM there’s no need for rewriting, because you can run Python, Java and C not only on the same virtual machine but also at the same time in the same process.

Mix as you like

Moreover, developers can choose the programming tools they are most comfortable with and which fit the best for the task at hand. They can even use different languages in one single program, and run everything using the safe environment of the GraalVM. Also, they can debug from one language to another.

– Typically, the most common and well-established languages like Java or JavaScript have the better tools, says Bruno Caballero, head of Virtual Machine Technologies at Microdoc.

– Many people have put a lot of effort into the infrastructure of theses languages and that gives you more quality and stability, compared to newer and less mature languages like R or Ruby.

– If we take a look at the Java ecosystem for instance, you have code review tooling, static code analysers, and many other tools that have been there for years. It’s all really stable and high quality. So, if you’re a young programmer who has used JavaScript to develop a library to do some mathematic processing, you may not even have tested that library properly. Using the GraalVM you can still write code in JavaScript, but use the math-libraries from the Java world because they are of proven quality. GraalVM gives you that possibility, and you can do so in every language. You can code in Python, but use the libraries from the Java world or the other way around, if you want.

– Furthermore you can use GraalVM as the runtime for you own application specific language by extending it. You can choose to extend it yourself or let MicroDoc do it for you.

Good for working together

Another strongpoint of the GraalVM is that it allows developers to work together, even if their skill sets are very different. You can have a diverse team of experts in Python, Ruby, Java, JavaScript etc. working together on the same product.

And even when it comes to long-term projects running over several years, due to the polyglot features of the GraalVM, senior developers can write in their preferred coding language, while new developers are free to choose something else. And senior developers will not be restricted to just maintaining old code, while the youngsters can have a go at the new and fancy stuff. Both parties can work in the same world, on equal terms.

Updating legacy code

Also, the GraalVM creates a new possibility for handling legacy code. Currently if you want to update legacy applications, you can choose to rewrite them from scratch, or write software around them to add additional APIs. Rewriting part of the legacy software in a different language, and keeping the remaining part unchanged has been very complicated in the past because you had to integrate code over language and runtime system barriers, for instance code running in a VM with native code running directly on the OS.

Now you can just run the legacy stuff in the GraalVM together with new code. For instance you can take out one class, write it in Java and take another functionality and rewrite it in Python. Everything will be running on the same VM, communicating inside the virtual environment.

At the same time, using the GraalVM makes decision-making easier, when it comes to new projects.

– When you start a new project you always discuss which language and which libraries to use, says Dr. Christian Kuka.

– That can be tricky, as one project is always connected somehow to a lot of other projects. The polyglot feature of the GraalVM allows you to choose much more freely. So, all in all, the GraalVM has a lot to offer, to developers as well as to project managers. It will make embedded development significantly more agile, efficient and future-proof.