Contact

The “One VM” Concept - towards the holy grail

The “One VM” Concept - towards the holy grail

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 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 of 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 bytecode, 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 integration of machine learning, neural networks and deep learning applications into your usual business applications. Most of the A.I. 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 code 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 fits the best for the task at hand. They can even use different languages in a single program, run everything using the safe environment of the GraalVM, and 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 analyzers, and many other tools that have been there for years. It’s all really stable and of 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 have even tested that library properl but using the GraalVM, you can still write code in JavaScript while using the math-libraries from the Java world because they are of proven quality. GraalVM gives you that flexibility while using any language. You can code in Python but use the libraries from the Java world or vice versa.

Furthermore, you can use GraalVM as the runtime for your own application specific language by extending it. You can choose to extend it yourself or let MicroDoc do the hardword 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. all 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. 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 parts of legacy software in a different language and keeping the remaining parts unchanged used to be very complicated. In the past, you had to integrate code over language and runtime system barriers, for example, there could be 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 and 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 somehow always connected to a lot of other projects. The polyglot feature of the GraalVM allows you to choose much more freely. Overall, GraalVM provides substantial benefits to developers and project managers alike. It will make embedded development significantly more agile, efficient, and future proof.