Java 8 Vs. Java 9: Get Ready for a New Era
The average business owner just wants his software or apps to work stable. He either has in-house developers, or he outsources. Either way, he determines what he wants a new software to do, conveys that to his developers, and expects them to come through. What he has a right to expect is a custom solution, designed specifically for his company, that, with some training and support, will meet his expectations for performance.
More often than not, this means that developers turn to Java, a programming language with amazing versatility. Today, there are more than 6.5 million Java developers globally, because of its utility, ease of use, security, reliability, and the platform independence (it works no matter what the hardware or the operating system is in use).
Why Java and Java 9?
Java was developed by Sun Microsystems in 1995, originally designed for interactive television. When Java 1.0 was released publicly, however, it had shifted focus to Internet use. And it became one of the most popular programming languages for all of the elements listed above.
Obviously, there have been many updates since 1.0. The latest version is Java 8, in the process of being replaced by Java 9. Oracle announced the Java 9 release date of September 22, 2016, with a rolling out of new features and elements over the next 16 months. That date has been moved to March and now to July 2017 for a number of reasons, but primarily because the developers want to take extra time to ensure that bugs and issues are fixed before the release – something that was not done with the release of Java 8.
Java 9 has been a long time coming, and here’s why. When Oracle bought Sun Microsystems in 2010, Java was kind of on hold during the long purchasing process. It lost a lot of talent. Oracle had to rebuild a Java development team, which then began the process of revising and the long-desired modularization.
There are lots of features of Java 9 that have developers pretty excited. And these new features will have important implications for businesses that want fast, efficient and robust custom software solutions.
More read: DevOps Team Structure and Best Practice
New Features of Java 9: Quick Summary
While much of this may not mean a great deal to a business owner, the new features of Java 9 have lots of meaning for developers, as they look at what’s new. Here is an overview of four of the most important.
- Jshell: This is a new command-line tool. It means that if a developer wants to run just a few lines of Java as a standalone, it can be done without having to wrap it all in a separate method or project.
- Microbenchmarks: Now, the performance of very specific and small pieces of code can be measured with a standardized method. The Java harness (JMH) for analyzing down to nanoseconds is unique to Java 9.
- Full Support for HTTP 2.0 Client: This is a speed thing, and HTTP 2.0 Client has shown to provide greater speed, ranging from 11.81% to 47.7% over HTTP 1.1 Client.
- Process API: An API (application programming interface) allows the app’s processes to communicate with each other without using native code. This update in Java 9 will extend the ability of Java in controlling and managing OS processes.
- Modular Source Code: Organizes JDK source code into modules.
That sounds promising, isn’t it?
From rational perspective the most awaited feature for me is the new HTTP Client that supports both HTTP/2 protocol and WebSocket. And here’s why:
- Non blocking mode support (many threads per request/response).
- Enhanced performance (by 45% in comparison to HTTP/1.1) that will be on par with Netty or Jetty.
- Server push support which will make possible to push resources to the client without an explicit request.
The second feature (less important though the cute one) I’m looking forward to is the Streaming API improvement, especially the dropWhile and takeWhile methods that will be very useful in functional programming.
— Ivan, Senior Java Developer at Romexsoft
Comparison of Java 8 and Java 9
Java 8 features have given developers remarkable versatility and the ability to provide software solutions to a wide variety of business sectors, including fintech, healthcare, and other industries.
The coming of Java 9, however, promises to deliver even more versatility and the ability to customize even further. For businesses, this is a huge plus.
Here, in rather simplistic terms, are just some new features of Java 9 that Java 8 did not have.
The Reason for the Title “Jigsaw”
Project Jigsaw is the modularization of Java. Basically, it means that the programming code is broken up and organized into modules based upon the tasks that those modules execute. By doing this, modules are reusable and far easier to manage and debug. This means that software development becomes easier, more streamlined, and debug faster. This is a key difference between Java 8 and Java 9.
The second big benefit – it makes the Java Platform more lightweight and more scalable. It allows Java applications to run even on devices with low productivity (requires less resource to work).
The latest Java 8 release brought a variety of new features that significantly changed developer’s life. But what’s more, Oracle prepares to release Java 9 with a bunch of new groundbreaking ones.
For me, the most anticipated feature of Java 9 is Jigsaw project which introduces a new module system that breaks the JRE into interoperable components.
With a modular JRE, applications will be enabled to run on even embedded systems. This is an especially huge change in the context of the advent of Internet of Things (IoT). It carries forward Java and it means we have a chance to have a big number of IoT apps written in Java.
— Yura, Senior Full Stack Java Developer at Romexsoft
The Jshell Command Line Tool
As mentioned above, this is an interactive tool that will allow testing of small snippets of code rather than requiring the creation of a new class. This new shell also comes with history and auto-completion features as well as other functionalities, like saving and loading some or all written statements.
This API will allow the encapsulation of a set of images that all have different resolutions into a single object. Thus, a developer can retrieve an image that is resolution-specific or retrieve all variants within the image.
Unified JVM Logging
Now there is a common logging system for all JVM components. However, if we look at the pros and cons of Java 9, here is one. It doesn’t add logging calls from all JVM components and doesn’t add logging to Java code in the Java Development Kit.
This is an improvement over Java 8, as these interfaces will better support the interoperability of a number of asynchronous systems that run on JVMs (Java Virtual Machines). The idea behind JVM’s is that they allow any computer to run a Java program, by converting Java code into machine language and then executing it. Improvements in this area are one of the big advantages of Java 9.
Immutable List, Set, Map, and Map.Entry API
In Java 8, to create a collection of several elements, a developer had to create several lines of code. Now it can be accomplished in a single line of code. One of the time-consuming disadvantages of Java 8 has thus been eliminated.
I’m expecting the Stream API Improvements. Why? It will facilitate the work with arrays and accelerate various functions.
As an example, check this:
Stream.of(1,2,3,4,5,6,7,8,9,10).takeWhile(i -> i < 5 ).forEach(System.out::println);
Will deliver: 1 2 3 4
Looks promising, isn’t it?
— Mykhaylo, Team Lead at Romexsoft
Benefits of Java 9 For Businesses
Granted, the details of Java 8 vs. Java 9 may not be of huge interest to the business looking for the best software solutions to meet its needs. To the developer, however, there will be a significant difference between Java 8 vs. Java 9 performance in creating those software solutions.
Whether using Java SE 9 or any other version, dependent upon the business need, the inclusion of the latest features will bring about improvements in the following:
- Greater speed of development, specifically due to the system of modules that are reusable and much easier to debug and to manage.
- One more benefit of the system of modules is that it will improve the resource effectiveness of applications (small or big ones) as for their development programmers will need to take only needed modules instead of all JRE.
- Creation of sets using a single rather than several lines of code.
- Microbenchmarks that will allow performance analysis of very small pieces of code.
- Support for HTTP 2.0 Client – greater speed.
And this is just a partial list. But all of these and the other new features make the developer’s job of designing the roadmap for a custom business solution and then creating the software based upon that roadmap more streamlined. That streamlining of developing, testing and debugging means that the final product will have far fewer issues that need to be addressed. In this type of development environment, everyone wins.
If you are looking for expertise in software solution development, we invite you to contact Romexsoft, present your need, and allow us to provide you with an overview of how we can meet that need through our current Java 8 expertise and the use of Java 9 features that are soon rolling out. We are ready and embracing this new era of Java!
Author: Yura Bondarenko