Java: Evolving With The Times

669

Java, the general-purpose, open-source programming language that was developed in 1995 is still going strong. Even though the business-technology landscape has undergone a massive transformation in the last 25 years, it has managed to thrive and remain at the heart of modern IT operations and application development.

“We’re trying to provide developers with the tools to address the workloads that exist today and that will exist in the future. We’re working on making  Java friendlier to containers,” says Aurelio Garcia-Ribeyro, Senior Director of Product Management at Oracle. He is also the Principal Product Manager in charge of Java SE since 2010.

Staying relevant

Java had to change a few things to keep up with modern workloads.

“There was this monolithic Java Runtime. We had many applications using and sharing that same runtime, which was why it always had to be complete. Modern applications, on the other hand, are usually not deployed that way. They don’t share a runtime, so why do we need a massive Java Runtime that provides capabilities that your applications don’t need?” argues Garcia-Ribeyro.

With the jlink tool, developers can now carve out the pieces of Runtime that their application doesn’t require. The tool provides a custom Java Runtime image that carries only the platform modules needed for a given application.

“It’s Java as usual, but the Runtime is smaller because it’s not shipping along or loading all of the pieces that you are not going to use anyway.”

When developers give Java bytecode to a Java virtual machine, it converts it to machine instructions based on the architecture and the characteristics of the machine on which it’s running. The same bytecode, therefore, produces very different machine instructions depending on the machine’s memory and cores.

“We’ve worked to make sure that maybe the hardware has all of that but the container is constrained. So, even though the hardware has a bunch of cores, you only get to play with this piece of the set. You can only use this much memory. We’re only always working to improve things like that,” he explains.

According to Garcia-Ribeyro, “Java is the number one development language for the cloud as well.”

“The characteristics that make Java a very robust and good language for enterprises also allow us to produce something that’s really good for the cloud. Java has been multithreaded from the beginning. It runs in many different environments and isolates you from the hardware,” he says.

Latest release highlights

The Java Development Kit 14 (JDK 14) was released recently with several Java enhancement proposals (JEPs) to help developers.

“JDK 14 is another one of those six-month releases that we’ve been producing since JDK 9. It no longer has a huge list of 100+ major enhancements with three or four high-level massive changes that are going to rock everybody’s development world. What we have instead is continuing the pace of innovation,” says Garcia-Ribeyro.

Some of the features, such as switch expressions, actually came out of Project Amber. It was included as a preview feature in a prior release, but it’s now part of the standard.

There are two preview features: records, which enhance the language’s ability to model “plain data” aggregates with less ceremony, and text blocks, which is the ability to write multi-line string literals without the need for most escape sequences.

There is also a new packaging tool that “will allow you to package your Java application so that it looks like a native application. With this tool, you can grab your job application and wrap the pieces of the Java Runtime that you need plus your application, put all of these in a nice package that looks like a native application for each platform and distribute that,” Garcia-Ribeyro explains.

“We have a new foreign memory access API, which will be the first feature that comes out of Project Panama. It gives a standard API for doing things that previously people used sun.misc.Unsafe for,” he reveals.

The JFR event streaming enables developers to analyze and monitor Java virtual machines running in real time.

Continuous innovation

To keep the momentum of innovation unabated, Java has several projects underway: Project Panama aims to make interactions between native libraries or libraries written in any other language and Java programs easier; Project Amber finds ways to simplify the language without compromising readability; while Project Valhalla finds new ways of handling memory.

“It’s always a dangerous proposition for us to try to predict what new things are coming out. The only thing that’s pretty safe is the things that are now in preview mode. We still continue to work to tighten them up and make sure that they’re ready for the next feature release. We want to deliver these incremental improvements. Every now and then, we will deliver something more massive, but the total addition of all of these will have a substantial impact,” Garcia-Ribeyro adds.