Modular Programming in Java 9

Kick-start your modular programming journey and gear up for the future of Java development

Modular Programming in Java 9

Koushik Kothagal

Kick-start your modular programming journey and gear up for the future of Java development
Mapt Subscription
FREE
$29.99/m after trial
eBook
$22.40
RRP $31.99
Save 29%
Print + eBook
$39.99
RRP $39.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$22.40
$39.99
$29.99p/m after trial
RRP $31.99
RRP $39.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781787126909
Paperback298 pages

Book Description

The Java 9 module system is an important addition to the language that affects the way we design, write, and organize code and libraries in Java. It provides a new way to achieve maintainable code by the encapsulation of Java types, as well as a way to write better libraries that have clear interfaces. Effectively using the module system requires an understanding of how modules work and what the best practices of creating modules are.

This book will give you step-by-step instructions to create new modules as well as migrate code from earlier versions of Java to the Java 9 module system. You'll be working on a fully modular sample application and add features to it as you learn about Java modules. You'll learn how to create module definitions, setup inter-module dependencies, and use the built-in modules from the modular JDK. You will also learn about module resolution and how to use jlink to generate custom runtime images.

We will end our journey by taking a look at the road ahead. You will learn some powerful best practices that will help you as you start building modular applications. You will also learn how to upgrade an existing Java 8 codebase to Java 9, handle issues with libraries, and how to test Java 9 applications.

Table of Contents

Chapter 1: Introducing Java 9 Modularity
Modularity in Java
Rethinking Java development with packages
Java - the 20-year-old code base
Java Platform Module System
Project Jigsaw
Summary
Chapter 2: Creating Your First Java Module
Setting up the JDK
Switching between JDKs
Setting up the NetBeans IDE
Java 9 modules
Creating a module using NetBeans
The address book viewer application
Handling possible errors
Summary
Chapter 3: Handling Inter-Module Dependencies
Creating the second module
Compiling two modules
Configuring module dependency
Module versioning
Rethinking package structure
Understanding module path arguments
Revisiting classpath
Revisiting the classpath problems
Summary
Chapter 4: Introducing the Modular JDK
Examining the legacy JDK
Enter Project Jigsaw
Platform modularity
Observable modules
Revisiting the two problems
Summary
Chapter 5: Using Platform APIs
Adding logging ability
Reading contacts from an XML file
Adding UI with Java FX
Summary
Chapter 6: Module Resolution, Readability, and Accessibility
Readability
Accessibility
Tweaking modularity
Applying the concepts to address book viewer
Summary
Chapter 7: Introducing Services
The problem of coupling
Understanding services
Advanced services
Services and the module system goals
Summary
Chapter 8: Understanding Linking and Using jlink
Module resolution process
Revisiting the state of the JDK
Linking using jlink
Building a modular JAR file
Summary
Chapter 9: Module Design Patterns and Strategies
Designing modules
Modularizing by concerns
Modularizing by layers
Modularizing by change patterns
Designing API
Java modules coding patterns and strategies
Summary
Chapter 10: Preparing Your Code for Java 9
Beginning Java 9 migration
Introducing the sample Java 8 application
Using the Java 9 compiler and runtime
Understanding the impact
Recommended strategy
Summary
Chapter 11: Migrating Your Code to Java 9
Understanding the migration goal
Beginning the migration
Handling larger codebases
Migrating libraries
Building libraries for multiple Java versions
Summary
Chapter 12: Using Build Tools and Testing Java Modules
Integrating with Apache Maven
Unit testing modules with Java 9
Wrapping up
Summary

What You Will Learn

  • Get introduced to the concept of modules and modular programming by working on a fully modular Java application
  • Build and configure your own Java 9 modules
  • Work with multiple modules and establish inter-module dependencies
  • Understand and use the principles of encapsulation, readability, and accessibility
  • Use jlink to generate fully loaded custom runtime images like a pro
  • Discover the best practices to help you write awesome modules that are a joy to use and maintain
  • Upgrade your old Java code to use the new Java 9 module system

Authors

Table of Contents

Chapter 1: Introducing Java 9 Modularity
Modularity in Java
Rethinking Java development with packages
Java - the 20-year-old code base
Java Platform Module System
Project Jigsaw
Summary
Chapter 2: Creating Your First Java Module
Setting up the JDK
Switching between JDKs
Setting up the NetBeans IDE
Java 9 modules
Creating a module using NetBeans
The address book viewer application
Handling possible errors
Summary
Chapter 3: Handling Inter-Module Dependencies
Creating the second module
Compiling two modules
Configuring module dependency
Module versioning
Rethinking package structure
Understanding module path arguments
Revisiting classpath
Revisiting the classpath problems
Summary
Chapter 4: Introducing the Modular JDK
Examining the legacy JDK
Enter Project Jigsaw
Platform modularity
Observable modules
Revisiting the two problems
Summary
Chapter 5: Using Platform APIs
Adding logging ability
Reading contacts from an XML file
Adding UI with Java FX
Summary
Chapter 6: Module Resolution, Readability, and Accessibility
Readability
Accessibility
Tweaking modularity
Applying the concepts to address book viewer
Summary
Chapter 7: Introducing Services
The problem of coupling
Understanding services
Advanced services
Services and the module system goals
Summary
Chapter 8: Understanding Linking and Using jlink
Module resolution process
Revisiting the state of the JDK
Linking using jlink
Building a modular JAR file
Summary
Chapter 9: Module Design Patterns and Strategies
Designing modules
Modularizing by concerns
Modularizing by layers
Modularizing by change patterns
Designing API
Java modules coding patterns and strategies
Summary
Chapter 10: Preparing Your Code for Java 9
Beginning Java 9 migration
Introducing the sample Java 8 application
Using the Java 9 compiler and runtime
Understanding the impact
Recommended strategy
Summary
Chapter 11: Migrating Your Code to Java 9
Understanding the migration goal
Beginning the migration
Handling larger codebases
Migrating libraries
Building libraries for multiple Java versions
Summary
Chapter 12: Using Build Tools and Testing Java Modules
Integrating with Apache Maven
Unit testing modules with Java 9
Wrapping up
Summary

Book Details

ISBN 139781787126909
Paperback298 pages
Read More

Read More Reviews

Recommended for You

Node.js 6.x Blueprints Book Cover
Node.js 6.x Blueprints
$ 39.99
$ 28.00
Learning Vulkan Book Cover
Learning Vulkan
$ 43.99
$ 30.80
Building an RPG with Unreal 4.x Book Cover
Building an RPG with Unreal 4.x
$ 39.99
$ 28.00
Game Engine Architecture Book Cover
Game Engine Architecture
$ 43.99
$ 30.80
Unity 5.x By Example Book Cover
Unity 5.x By Example
$ 39.99
$ 28.00
Unreal Engine 4.X By Example Book Cover
Unreal Engine 4.X By Example
$ 39.99
$ 28.00