Dec 3, 2016

Biggest recent change in Java

Past big changes include Generics and Lambdas and Next big change is modularization - project jigsaw - that is on going for a very long time - coming live in Java 9.
Big problems solved by modularisation are Classpath and monolithic JDK. Modules - breaking JDK into multiple modules.
Java architects have realized over time JDK has became on big monolith platform with many components/packages.

The list of packages only grows with time - we have experienced this - how many jar's we include in the classpath or include in library. A sample from Hadoop is below -
Module -
Classes and interfaces are part of package.  Packages will now be organised into module. So module is a component similar to class and package. Module is collection of packages. A module can be dependent on multiple other modules. Module will export packages for use to modules that depend on it.
To create a new module - Create a new java file and instead of class say module -

It will be compiled like a java file. Above module depends on one module ( and exports two packages inside it for use to modules that will depend on it.

So print for a simple program - print Hello World; we need only one module not complete jars from jdk - only one base module - java.base

For more information - a very nice video is available -


No comments

Post a Comment


© Technology Strategy, Architecture, and Development | All rights reserved.
Blogger Template Crafted by pipdig