Published Sep 3, 2019

SE-Radio Episode 316: Nicolai Parlog on Java 9

Discover the transformative impact of Java 9 with Nicolai Parlog, as he delves into its new Module System, evolutionary changes since Java 8, and key features like default method enhancements that aim to revolutionize dependency management and streamline coding practices.
Episode Highlights
Software Engineering Radio - the podcast for professional software developers logo

Popular Clips

Episode Highlights

  • Module System

    The Java Module System, introduced in Java 9, aims to address several longstanding issues in Java development. explains that the system provides a structured way to manage dependencies and encapsulation, breaking down the monolithic nature of Java into smaller, more manageable modules 1. This modular approach not only reduces the size of the Java runtime but also enhances security by ensuring that only authorized code can access certain parts of the JDK 1.

    The big change in Java nine is the introduction of modules. How do you like to explain modules to people who know Java perhaps, but are new to the concept of modules.

    ---

    uses a graph metaphor to describe how classes and methods interact within this system, highlighting the improved organization and clarity it brings to Java codebases 2.

       

    Dependency Mgmt

    The Java Module System revolutionizes dependency management by enforcing strict rules on module dependencies. notes that the system prevents the launch of applications if any required dependencies are missing, ensuring a complete dependency graph before runtime 3. This approach eliminates common issues like version conflicts by disallowing multiple versions of the same module on the module path 4.

    The JVM would not let me launch because something's missing. So it understands the concept of this, of this dependency graph of their nodes, and if they are gone, then something's not right.

    ---

    Additionally, the system requires explicit declarations of transitive dependencies, promoting clearer and more maintainable code 5.

       

    Encapsulation

    Enhanced encapsulation is a key benefit of the Java Module System, providing developers with greater control over code visibility and usage. explains that this system allows developers to define clear boundaries for their code, reducing the risk of unintended dependencies on internal APIs 6. This encapsulation not only aids in code maintainability but also accelerates development by allowing changes within modules without affecting external code 7.

    It gives the developer more power, the maintainer of a library of code, more power to say what is going to be used and what is not going to be used.

    ---

    emphasizes that while some may view this as an added complexity, it ultimately simplifies project management by enforcing a disciplined approach to code organization 8.

       

    Migration Process

    Migrating to Java 9 and its module system involves a two-step process: migration and modularization. advises developers to first ensure their Java 8 applications run on Java 9 without modules, addressing any compatibility issues that arise 9. This initial step is crucial for a smooth transition, as it involves updating dependencies and resolving potential conflicts 10.

    Going all the way from Java eight to modules is by and large a two step process.

    ---

    Once the application is stable on Java 9, developers can gradually introduce modules, taking advantage of the system's benefits without overwhelming changes 11.

Related Episodes