Saturday, December 9, 2017

What is new with Java 9

Being a Java professional, if you were waiting for the big news then finally here it is - Java 9 has been released into the technical workspace recently and the features embedment is just amazing. In this article, we will take a quick tour of the new features introduced in Java 9 and how they can help you in getting your programming skills better.

The modularization with project Jigsaw

After the release of Java 8, Lambdas and improved APIs functionalities changed the daily life of the Java developers. However, one feature that was awaited since a long time to become the highlight of freshly released Java 9 version i.e. modularization with the project jigsaw.

Before modularization, JDK was defined as a programming environment with various undesirable dependencies between different areas of implementation. There was a quick need to eliminate all of these dependencies to get a more modular Java program.

The Jigsaw module system helped in starting compilation with base module only. The Java applications can be started by installing base modules only that are actually needed by the program, not any other undesirable module components. In this way, it will enhance overall runtime and compile-time capabilities with the reliable configuration setting enhanced encapsulation mechanism.

With Java 9, you would be able to design your own modules with the declaration of multiple packages inside. Let us see a quick example, how to create or define modules in Java 9 version.



In this example, we have been used two keywords “exports” and “requires” with significantly different purposes. The “Exports” keyword will tell you about the packages you wanted to show to the outside world. At the same time, the “requires” keyword signifies about the packages you need from the outside. The concept may be a little bit confusing at first glance, but it goes really interesting with practical implementation.

Modules can also be used as classical JAR files inside classpath. In Java 9, modularization concept has replaced the keyword “classpath” with “modulepath” where you can find all the modules declared by you.

Domain-driven design with Java 9

With the introduction of modularization in Java 9, it has become possible for the developers to make software architecture better and more expressive. Now the layers in software architecture can be defined as modules and each of the interfaces can be defined more precisely as compared to the past.

This would be easy for the compiler as well to detect or prevent the architecture violations. Let us have a quick look on domain-driven design with Java 9 –





Wanted to get a closer idea of the concept? Consider an example of banking app, where all of the four layers will be defined as modules in such interesting way that there are no dependencies within modules. In other words, each of the modules can be executed independently based on the requirements. 





JDK and JRE itself divided into small pieces

The concept is not interesting for projects only, but modularization has a great impact on JDK and JRE itself. With the introduction of modularization in project jigsaw, JDK and JRE have been divided into small modules that can be accessed independently. Prior to Java 9, there was a need to deliver the entire JRE even if you are working on a small program that has not the database or Graphic User Interface. 

Cutting the JDK and JRE into pieces will allow each program to define what it actually requires.  It will optimize memory storage and improve the overall performance of Java programs too. This would not be saying wrong that Project Jigsaw is the most amazing change experienced by Java developers as of now that has been changed entire picture of Java versions available so far.

UNICODE and HTTP / 2 Support in Java 9

Java 9 supports UNICODE 7.0 to code characters of different languages. With the extension of UNICODE, you can make your Java application more interactive and readable too.

Till the time, Java was supporting the old version of HTTP protocol that was really slow and not acceptable by modern users. The HTTP / 2 support has been given in Java 9 to reduce latency. Now web pages could be loaded much faster as compared to the past. However, compatibility with older version still remains maintained. This is not yet certain how successful HTTP / 2 is going to be but changes are evitable and assure great learning experiences too.

In the final words, changes in programming world don’t end here but this is an on-going process. Java community promises for the newer version after every six months or a year. If we talk about the Java 9 version in brief then modularization is the most appreciable modification to the new release that will make the certain things easier for developers. We expect something more interesting and beyond our imagination in upcoming features. Till the time, there is need to practice the latest advancements and to make maximum benefits from new technologies introduced with the release of Java 9.

Author

I am the Java Trainer with JanBask Training. I work on the content that compiles the insights of JanBask Training Network for Java covering the latest trends in the industry. Here you can get Java Training and latest Jobs Oriented Java Interview Questions and Answers

No comments:

Post a Comment