Introduction to Modules, Modularity, and Java 9+'s JPMS

5 minutes
Share the link to this page
Copied
  Completed

Transcript

Hello, and welcome to the course Gemini modularity. In this course, we're going to just talk about the basics. There are lots of things to be said about Gemini modularity. But in this first course, just touch the surface. The other names, which you could find about Gemini module, or the is Java Platform Module system, or j PMS, or Intel in his project, jigsaw. Actually, what you'll learn in this course is what are modules why modularity is very important, especially in software design, and how can we achieve that in Java nine.

The basic knowledge that you should have before taking this course is that you should be aware of Java programming, Java application design and your application development in some kind of ID. You're going to be using Windows operating system, but probably if you use one of those popular IDs like NetBeans, or Eclipse or IntelliJ IDEA, you're mostly cross platform and you don't need to worry about differences between the operating systems. So we basically start by the question, what are the modules so as you see in this definition, The modules are going to be interoperable components, which could make up your project, you actually don't need them for small one modular applications, I basically mean the designs which remained monolithic. So these kind of monolithic designs are going to be used for small simple applications. And these applications don't have any requirements basically, for encapsulated. Other almost interchangeable components.

We're basically saying that if your applications get larger than you need to have some kind of module support in your application in order to have a better managed code. In other words, your application could be made of interchangeable interoperable modules connected together and have interaction with each other. So as you see in this slide, modularity is the most important new feature of Java nine basically, Java eight added a new dimension to programming which was functional programming. In Java nine added a new approach to design which is basically JP ms or the module system to the language as a brief history is a small small a decade ago. plan to be originally done for Java seven, but then proven to be too big and then had to be pushed out to Java eight and then to Gemini and even do a release of Gemini for one year.

So as you see an expect it's been a large project. And now you could say the whole Java API is kind of modular. It's basically all about design. So why is much larger than important? why it's so important in software design in general? Well, actually, as your application or software gets larger and more complex, you'd more find yourself in the position that your application should be decomposed into smaller components or modules, which all makes your code more manageable.

That's the most important thing in software design software implementation. Basically, these components or these modules should be encapsulated standalone components, which could have interaction with each other in a loosely coupled way. And as you know, having a loosely coupled interaction between the components of a program is always a desire for programmers in action. Each of these components could be composed and expanded even interchange and exchange independently of the other ones is going to be the same as we have in other industries, then programming, you have systems composed of different modules, which could be composed, which could be expanded, which can be interchange, which could be exchanged independently of each other. So you might say, why if you don't have modularity? Well, the answer is in the absence of modularity, you will have a monolithic system, which could be more than enough for small scale software is basically delivered as one big piece, all made by the same manufacturer.

And as a result, adding and or replacing options would be hard, as there are no interchangeable components, you will always need a long time to build and deploy your solution. And any changes might easily break your code because it's just one big piece of software. So compare that one with a modular system, which gives you the option of having different loosely coupled and capsulated. And when I say encapsulated, I mean The modules internals are going to be protected. Again, you're going to have different loosely coupled, encapsulated, interchangeable components or modules, where you could easily manage to add or remove or replace components, as long as the interfaces between the components are preserved. So if the interfaces between the components which make them having some kind of interaction is going to be preserved, you're going to have these components as manageable pieces, which overall make your application up and running.

Now that you've got the importance of modularity in software design, the good news for Java programmers is that in Java nine using Geminis jpm s, we could treat modules as first class citizens of the language. What that means is that the jaypee ms not only forces you to think about the modules from the beginning of your design, but also gives you new syntax and tools to use in your code developments. In fact, after Gemini, the JAMA platform itself has been modularized and so could be deployed more efficiently in a store and more quickly on some smaller devices which probably don't need to have or use all of the Java API on them Gemini is JPS introduces the module pad which tells the compiler where to find modules to compile and to the runtime environment. It says where to find them to run the application. In fact, each module is now a separate hierarchy, which is considered to be at a higher level than packages, we normally give them package names and each new module should have a different package name and I will show you all these in the examples soon

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.