Get a first look at the all-new Java module system. In this course, you'll learn about modularity concepts such as encapsulation and explicit module dependencies, as well as how to migrate your existing code to Java 9.
The upcoming Java 9 release delivers a brand new module system as its flagship feature. In this course, Java 9 Modularity: First Look, both the concepts and practice behind modular development are introduced. First, you'll learn what modules are and how modular design using the Java module system increases the flexibility, maintainability, and security of your applications. Next, using a Java 9 Early Access release, these concepts are illustrated with real, working code. Finally, the issue of migrating existing applications to the new Java module system is addressed as well, with features such as automatic modules. When you're finished with this course, terms like encapsulation and explicit module dependencies will be no secret to you. After this course, you'll be ready for modular development with Java 9.
Sander is a Fellow at Luminis in The Netherlands, where he crafts modular and scalable software, most often on the JVM, but with a touch of TypeScript when needed. He also is a Java Champion and author of the O'Reilly book 'Java 9 Modularity' (see javamodularity.com). As an avid conference speaker, Sander loves sharing knowledge, also through his blog at http://branchandbound.net and as Pluralsight instructor.
Course Overview Hi everyone, my name is Sander Mak, and welcome to my course: Java 9 Modularity: First Look. I'm a senior software engineer at Luminous Technologies in the Netherlands, and author of the upcoming O'Reilly book, Java 9 Modularity. Did you know that Java 9 will be released in July 2017, and contains a completely new module system? In this course, we'll learn all about the features of this new module system, using a 9 early access release bills. Modules provide new opportunities to improve the large skill structure and design of your code base. It's a big change to both the Java language, libraries, and the Java virtual machine, but modular software development is as much about design as it is about new language features. So, we'll approach the topic from both perspectives. Some new concepts you will learn are strong encapsulation, explicit module dependencies, and services that are built on top of the module system. Besides learning about these new features, you'll also learn how to migrate existing code to Java 9. That way, you'll be prepared when Java 9 is released. Since we're working from an early access release of Java 9, you'll see work in code and many demos, but some details may still change. However, the fundamentals of working with modules in Java 9 as discussed in this course are here to stay. This course assumes you have experience building large Java Applications. I hope you'll join me on this journey to learn modular developments with the Java 9 Modularity: First Look course, here at Pluralsight.
Working with Modules Hello, and thanks for joining me in this module on Working with Modules. Yes indeed, modules in plural, because having a single module won't do very much for a modular application. So in this module, we're going to add a second module to our example application, and see how we can grow that to a modular application step-by-step. When you're working with multiple modules, there's a new concept to learn: module resolution. The Java compiler and the Java runtime resolve modules based on the data provided in our Module Descriptors. We'll learn how Java resolves modules, and how this is a step up from the Classpath. We'll also get a bit more technical about what it means to require another module. You'll see that requiring another module leads to a readability relation, and that you can also have implied readability or transitive relations. Finally, we're going to put our knowledge to work and create a third module for the EasyText application. This will be a GUI module, and will be the first module that we create that uses platform modules other than java. base. In this module, we're going to build upon our knowledge on how to create modules. Remember how a module has a Module Descriptor in which you can express dependencies using requires, and you can express which packages of your module are available to other modules using the exports statements. We're also going to use the Java compiler with the new module-source-path link again, and run modules using the Java command and the module-path, but first, let's see how we can split up our single EasyText module into multiple modules.
Exposing and Consuming Services Hi, and thank you for joining me in this module on Exposing and Consuming Services. So far, we've talked a lot about what modules are and how they are created, but in this module, we're going to look at the interaction between code living in modules. We'll see that on the one hand, encapsulating code in modules is a good thing, but on the other hand, it will bring some complications to our code. In this module, we're first going to have a look at what the limits of encapsulation are. We'll learn that sometimes we need to expose too much to the outside world to create a workable situation. Of course, there's no problem that can't be solved, and we're going to look at the services mechanism in the module system to see how we can overcome these limitations. Finally, we're going to put it into practice by adding services to EasyText. What we want to achieve in the end is to create an extensible application where we can add additional analyses as services to EasyText. This will highlight the flexibility and usefulness of the services in the module system. Before we move on, it's important to reestablish what encapsulation means in the module system. Here's the example of the easytext. cli module reading the easytext. analysis module, but since the easytext. analysis module has a public exported part and an encapsulated part, there are three questions you need to answer: do you read the module? Yes in this case, but it's the package that you're interested in exported, and is the type that you're trying to access in this package public? If not, the code is and remains encapsulated in the easytext. analysis module.