官术网_书友最值得收藏!

What this book covers

Chapter 1, Introducing Java 9 Modularity, covers the status quo of code structuring and management in Java 8 and before. It outlines the challenges and pitfalls in maintaining and organizing large code bases over time, with the example of a large Java code base everyone is familiar with--the JDK. It then introduces Project Jigsaw and explains how the concept of modularity attempts to solve the challenges outlined in the previous chapter. It discusses the module-based changes to the JDK structure as well as the ability to create modules in application code.

Chapter 2, Creating Your First Java Module, gets you started on a sample code project that is written without using the module construct. It then guides you step-by-step through creating your first Java 9 module. It introduces you to the module keyword, the module-info.java class and how to define a custom Java module. It then covers compiling and running a module. It explains the structure of the .class files and how the runtime uses the same module definition to infer the module structure.

Chapter 3, Handling Inter-Module Dependencies, shows how modules can hardly work well in isolation. They are designed to be parts of a bigger unit and are meant to work with each other. This chapter covers creating a second module and having the modules depend on each other. You'll learn how to define such a relationship in Java 9, as well as how to compile and run a multi-module application.

Chapter 4, Introducing the Modular JDK, switches our attention to the Java platform, specifically the JDK. You'll learn about the important changes to the JDK that has resulted from the modularization of the platform. You'll learn about the modules that come out of the box with the JDK. You'll also learn about the tools and techniques to browse and get more information about any of those modules.

Chapter 5, Using Platform APIs, teaches you how to use the platform modules in the sample application through a hands-on step-by-step guide. You'll understand some of the challenges that you may typically face when depending on platform modules and how to solve them.

Chapter 6, Module Resolution, Readability, and Accessibility, delves deep into inter-module dependencies and how you can control the level of encapsulation for their modules and libraries. It continues the module resolution discussion of the previous chapter by adding two new criteria that influences the encapsulation and availability of Java elements--accessibility and readability.

Chapter 7, Introducing Services, looks at a vital element of coupling that exists between two modules in the sample application and how that prevents the extensibility and "plugging-in" of new modules. It explains the new Java 9 services, provides step-by-step instructions to encapsulate implementation classes, and uses ServiceLoader to look them up.

Chapter 8, Understanding Linking and Using jlink, introduces the static linking step in the Java 9 development process and what happens during it. It explains how linking plays an important part when developing modules in Java 9. It then provides step-by-step instructions to create a runtime image for the sample project, how to optimize it, and how to execute the image.

Chapter 9, Module Design Patterns and Strategies, covers several best practices when it comes to building modular applications in Java. Now that you have a good understanding of the Java module system features and how it works, the next question is when and how to use them? You'll learn how to establish module scopes and boundaries, how to define good module interfaces, and how to tackle some common challenges when building a modular application.

Chapter 10, Preparing Your Code for Java 9, walks you through getting an old sample code base (written in Java 7) ready to be migrated to Java 9. It illustrates the optional nature of Java modules and how a classpath-based code is automatically assigned to an "unnamed" module. It then provides step-by-step instructions to get legacy code to compile and run in Java 9. It also shows you how to handle issues with usage of encapsulated types, and how to work around them.

Chapter 11, Migrating Your Code to Java 9, walks you through upgrading legacy code to use the new modularity features of Java 9. You'll learn how to form a migration strategy for your code, as well as how to deal with dependencies that are not compatible with Java 9. You'll learn how to use Java 9 features that are designed to assist such migration, such as automatic modules and command-line overrides.

Chapter 12, Using Build Tools and Testing Java Modules, covers two important aspects of Java programming--build tool integration and unit testing. You'll learn to use Maven to structure your projects and align Maven's multi-module project concepts with Java 9 modular applications. You'll also learn how to test Java modules using JUnit.

主站蜘蛛池模板: 乐至县| 兴义市| 巴彦淖尔市| 堆龙德庆县| 象州县| 溆浦县| 京山县| 彭山县| 介休市| 罗源县| 皮山县| 洪湖市| 陵川县| 临朐县| 澄江县| 土默特左旗| 含山县| 永州市| 石棉县| 大厂| 延吉市| 阳江市| 漾濞| 普兰店市| 上栗县| 凭祥市| 湘潭市| 楚雄市| 雷州市| 靖边县| 如皋市| 赤峰市| 应用必备| 西城区| 林芝县| 冷水江市| 南充市| 九江县| 曲周县| 什邡市| 界首市|