← Blog/legacy modernizationenterprise technologysoftware developmentcloud computingprogramming languagesarchitecture

Java 9 Module System: Modularity and Encapsulation with Project Jigsaw Previews

Legacy Modernization Solutions
Advanced Legacy Modernization
Enterprise Legacy Modernization
Next-Gen Legacy Modernization
Java 9

Evaluating Project Jigsaw previews and the Java Platform Module System for building modular, maintainable, and scalable enterprise Java applications.

VP
SHIVAM ITCSLead AI Architect
·15 March 2017·12 min read·2 views
Java 9 Module System: Modularity and Encapsulation with Project Jigsaw Previews

Introduction

For more than two decades, Java has established itself as one of the dominant platforms for enterprise software development. Financial systems, telecommunications platforms, government applications, healthcare solutions, large-scale middleware, and countless business applications rely on the Java platform because of its portability, maturity, and extensive ecosystem.

As enterprise applications have grown, so too have their codebases. Large monolithic deployments often contain thousands of classes spread across numerous JAR files with loosely defined dependencies. Although Java packages provide logical organization, they do not offer strong encapsulation or explicit dependency declarations between larger application components.

Project Jigsaw introduces one of the most significant architectural changes in the history of the Java platform. The Java Platform Module System (JPMS) adds modularity directly to the language and runtime, enabling developers to define explicit module boundaries, declare dependencies, and expose only intended APIs.

As of March 2017, Java 9 remains in preview before general availability. Nevertheless, Project Jigsaw offers enterprise architects an opportunity to evaluate how modularity may influence future application architecture, deployment, and long-term maintenance.

Industry Background

Enterprise software continues evolving toward:

  • Microservices
  • Cloud deployment
  • Modular application architecture
  • Continuous delivery
  • Component reuse
  • Automated dependency management
  • Large distributed systems

Programming platforms increasingly emphasize modular design as a mechanism for improving maintainability, scalability, and deployment flexibility.

The Java ecosystem has historically relied upon packages and build tools to organize applications. Project Jigsaw extends this model by introducing modules as a first-class platform concept.

The Business Problem

Large Java applications commonly experience:

  • Weak encapsulation
  • Complex dependency graphs
  • Classpath conflicts
  • Difficult maintenance
  • Large deployment footprints
  • Limited component isolation
  • Accidental exposure of internal implementation classes

Managing these challenges becomes increasingly difficult as enterprise systems expand over many years.

Understanding Project Jigsaw

Project Jigsaw introduces the Java Platform Module System.

Rather than viewing applications solely as collections of JAR files placed on the classpath, applications can be organized into explicit modules that declare:

  • Module identity
  • Exported packages
  • Required modules
  • Dependency relationships

This enables stronger architectural boundaries while improving application organization.

Core Architecture

ComponentResponsibility
ModuleLogical deployment and encapsulation unit
module-info.javaDeclares module metadata
Module GraphDefines dependency relationships
Java CompilerValidates module dependencies
Java RuntimeResolves modules during execution
Exported PackagesDefine public APIs

Together these components establish explicit architectural relationships between application modules.

Module Descriptors

Each module contains a descriptor named module-info.java.

The descriptor defines important information including:

  • Module name
  • Required modules
  • Exported packages
  • Readability relationships

Unlike traditional package organization, module descriptors become part of the compilation and runtime model.

This allows tooling to understand application architecture more precisely.

Strong Encapsulation

One of Project Jigsaw's primary objectives is strong encapsulation.

Historically, any public class within a package could generally be accessed by other code present on the classpath.

Modules introduce a more restrictive model.

Only explicitly exported packages become part of a module's public interface.

Benefits include:

  • Smaller public APIs
  • Better architectural boundaries
  • Reduced accidental coupling
  • Improved long-term maintainability

Strong encapsulation encourages clearer ownership of implementation details.

Explicit Dependencies

Modules declare dependencies directly.

Instead of relying upon implicit classpath behavior, developers specify which modules are required.

Advantages include:

  • Easier dependency analysis
  • Improved tooling support
  • Better architecture visualization
  • Earlier error detection

Explicit dependency declarations simplify maintenance of large enterprise systems.

Module Resolution

During compilation and execution, the Java platform constructs a module graph.

A typical workflow includes:

  1. 1.Module descriptors are discovered.
  2. 2.Required dependencies are evaluated.
  3. 3.The module graph is constructed.
  4. 4.Missing dependencies are identified.
  5. 5.Accessible packages are determined.
  6. 6.Application execution begins.

The runtime validates relationships before application startup rather than relying solely on classpath resolution.

System architecture diagram and conceptual workflow layout for Java 9 Module System.

System architecture diagram and conceptual workflow layout for Java 9 Module System.

Migration Considerations

Many enterprise applications consist of extensive collections of existing JAR files.

Organizations evaluating Project Jigsaw should recognize that migration is expected to be incremental.

Possible strategies include:

  • Modularizing new libraries first.
  • Defining clear module boundaries.
  • Identifying internal APIs.
  • Reducing unnecessary dependencies.

Careful planning minimizes disruption while improving long-term maintainability.

Enterprise Use Cases

ScenarioBenefit
Enterprise MiddlewareImproved component isolation
Banking SystemsExplicit architectural boundaries
Large Business ApplicationsBetter dependency management
Shared FrameworksControlled API exposure
Cloud ServicesModular deployment organization
Internal Platform LibrariesStrong encapsulation

Organizations maintaining extensive Java codebases benefit most from improved architectural discipline.

Performance Considerations

Project Jigsaw primarily improves application organization rather than raw runtime performance.

Development teams should evaluate:

  • Startup behavior
  • Module resolution
  • Dependency organization
  • Deployment size
  • Build complexity

The greatest benefits are generally architectural rather than computational.

Security Considerations

Strong encapsulation contributes positively to software engineering practices by limiting exposure of implementation details.

Organizations should continue implementing:

  • Authentication
  • Authorization
  • Secure dependency management
  • Input validation
  • HTTPS communication
  • Secure deployment procedures

Module boundaries complement secure software architecture but do not replace application security controls.

Scalability

The Java Platform Module System supports long-term scalability through:

  • Clear architectural boundaries
  • Explicit dependencies
  • Better component reuse
  • Reduced coupling
  • Improved maintainability

These qualities become increasingly valuable as enterprise systems continue expanding.

Best Practices

Organizations evaluating Java 9 module previews should:

  • Design modules around business capabilities.
  • Keep exported APIs intentionally small.
  • Avoid unnecessary module dependencies.
  • Separate public interfaces from implementation.
  • Introduce modularization gradually.
  • Validate dependency graphs regularly.
  • Maintain architectural documentation.
  • Evaluate tooling compatibility during migration.

Well-designed modules improve maintainability throughout the software lifecycle.

Common Mistakes

Development teams should avoid:

  • Creating modules without clear responsibilities.
  • Exporting every package unnecessarily.
  • Treating modules as simple replacements for packages.
  • Ignoring existing architectural boundaries.
  • Attempting complete migration without planning.
  • Introducing circular module dependencies.

Successful modularization depends upon thoughtful application architecture rather than language features alone.

Technology Comparison

CapabilityTraditional ClasspathJava Platform Module System
Explicit DependenciesNoYes
Strong EncapsulationLimitedYes
Module DescriptorsNoYes
Dependency ValidationLimitedImproved
Public API ControlPackage visibility onlyModule exports
Architecture VisibilityModerateSignificantly improved

Project Jigsaw introduces modularity directly into the Java platform rather than relying exclusively on external build tools.

Adoption Strategy

Organizations should evaluate Java 9 modules incrementally.

A practical migration strategy includes:

  1. 1.Identify suitable pilot projects.
  2. 2.Analyze existing dependency graphs.
  3. 3.Define module boundaries.
  4. 4.Introduce module descriptors.
  5. 5.Validate build processes.
  6. 6.Evaluate runtime behavior.
  7. 7.Expand modularization across additional components as organizational experience grows.

Incremental adoption minimizes migration risk while allowing teams to refine architectural practices.

Limitations

As of March 2017, Java 9 remains in preview, and Project Jigsaw continues approaching general availability.

Current considerations include:

  • Existing enterprise applications may require substantial planning before modularization.
  • Tooling and ecosystem support continue evolving.
  • Migration strategies differ according to application architecture.
  • Organizations should evaluate third-party library compatibility carefully.

Pilot implementations provide valuable experience before broader enterprise adoption.

Looking Ahead

Project Jigsaw represents one of the most important architectural developments in the Java platform since the introduction of generics. By introducing explicit modules, strong encapsulation, dependency declarations, and improved runtime validation, Java moves toward a more structured model for building large enterprise systems.

As of March 2017, enterprise architects should begin evaluating the Java Platform Module System within prototype applications and shared platform libraries. Organizations that invest in modular application architecture, disciplined dependency management, and clear component boundaries will be well positioned to benefit as Java 9 approaches general availability and modular development becomes a core part of the Java ecosystem.

VP
Vijay Paliwal
Founder, SHIVAM ITCS · 18+ years enterprise & AI engineering
MCA · Ex-HiveGPT USA · Ex-Social27 Seattle

Related Reads

Java 9 Module System: Modularity and Encapsulation with Project Jigsaw Previews | SHIVAM ITCS Blog | SHIVAM ITCS