New lamps for old
Jan. 29th, 2019 08:31 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Book Review: Java 9 Modularity - Patterns and Practices for Developing Maintainable Applications,
by Sander Mak and Paul Bakker
Possibly a year ago, I dabbled with migrating one of the microservices I was working on to Java 9 in a spare couple of hours one afternoon. It didn't go well, and as anything involving extra Java effort was not likely to be well received at the time, I let the matter drop. Fortunately, in the intervening period it doesn't seem to have taken the world by storm, but with Oracle's support and licensing changes for Java 8, and the new Java release cycle, it's clearly not something that can be put off for ever.
This is a straightforward book that covers the essentials of the Java modules system, covers some real-world examples, and some more advanced topics. I suspect my problems were bad luck, as by chance the service I was working on used XML libraries, which is one of the modules that are now non-core (although for now still included in the standard Java distribution). Dependencies on well-structured modules seem straightforward enough; but the problem is that it's tricky to retrofit this into existing libraries. Some necessary features seem to undermine the purpose of modules, for example by "opening" code to reflection by other modules; the difference between compile-time and run-time needs to be borne in mind as there is a reversal of more traditional dependencies here. The book goes into some detail with a worked example using Spring and Hibernate - widely used real-world libraries - but the concepts of "automatic" modules and classpath libraries aren't intuitive, so I think this can probably best be learned by doing. Some of the source and implied JAR code layouts described are a bit confusing, particularly with regard to compatibility with existing tooling, although it's claimed that Maven and others will work with the new compiler. It clearly has the prospect of being a long haul before these concepts become transparent, but this book provides a solid introduction.
by Sander Mak and Paul Bakker
Possibly a year ago, I dabbled with migrating one of the microservices I was working on to Java 9 in a spare couple of hours one afternoon. It didn't go well, and as anything involving extra Java effort was not likely to be well received at the time, I let the matter drop. Fortunately, in the intervening period it doesn't seem to have taken the world by storm, but with Oracle's support and licensing changes for Java 8, and the new Java release cycle, it's clearly not something that can be put off for ever.
This is a straightforward book that covers the essentials of the Java modules system, covers some real-world examples, and some more advanced topics. I suspect my problems were bad luck, as by chance the service I was working on used XML libraries, which is one of the modules that are now non-core (although for now still included in the standard Java distribution). Dependencies on well-structured modules seem straightforward enough; but the problem is that it's tricky to retrofit this into existing libraries. Some necessary features seem to undermine the purpose of modules, for example by "opening" code to reflection by other modules; the difference between compile-time and run-time needs to be borne in mind as there is a reversal of more traditional dependencies here. The book goes into some detail with a worked example using Spring and Hibernate - widely used real-world libraries - but the concepts of "automatic" modules and classpath libraries aren't intuitive, so I think this can probably best be learned by doing. Some of the source and implied JAR code layouts described are a bit confusing, particularly with regard to compatibility with existing tooling, although it's claimed that Maven and others will work with the new compiler. It clearly has the prospect of being a long haul before these concepts become transparent, but this book provides a solid introduction.