Getting Further Modulerizing with Jigsaw in NetBeans IDE

Let's modulerize the Anagram Game using Jigsaw further than we initially did, using the Services idioms that are also part of Jigsaw, discussed in the previous blog entry.

Here's the use case, i.e., a small Anagram game: 

The category can be switched via the drop-down: 

The point of this blog entry is that "Technical" and "Animal" are both made available via service providers, each made available by a different Jigsaw module, "org.wordlibrary.technical" and "org.wordlibrary.animal":

Each of the service providers serve up an implementation of the same service, "com.wordlibrary", consumed by "com.toy anagrams".

The point is that the application is now pluggable. Simply introduce onto the module path new Jigsaw modules that implement the service and register them using their "module-info.java" class, as discussed earlier. It's all very similar to META-INF/services, except that here we're using modules instead of libraries, with all the advantages that modules bring over libraries, in particular the ability to hide the internals of a module from unintended access.

Pretty cool to have applied all the concepts discussed in the previous blog entry to a real example and it works.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java and JavaScript technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily, mainly on topics connected to Oracle JET and NetBeans IDE.

Search


Archives
« April 2017
SunMonTueWedThuFriSat
      
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
23
24
25
26
27
28
29
30
      
Today