So let's talk about a brand new feature in Java nine modules.
So one of the most important and exciting features of JDK 9 is the module system that was developed
under a project called time of jigsaw. So now Java 9 introduced a new program component known as a module.
So think of a job application as a collection of modules.
There's a module system was designed to have a reliable configuration, strong encapsulation and a
modular JDK/JRE.
So the purpose is to solve the problems typically involved with developing and deploying Java applications
prior to Java 9.
Now these modularity features in Java are collectively known as the Java platform module system
or JPMS.
So what is a module? So much it was a named collection of data and code.
Now much does it contain Java code that's organized as a set of packages which package tank classes
interfaces and so on.
So I think ultimately of a module as a container of packages.
Each module needs to have some configuration, name unique name of the module, inputs, what the module
needs to use and what is required for the module to be compiled or run as well as outputs.
So what the module output exports to other modules.
So doing it this way you don't have to specify every package that your module needs.
I know the name of a module you depend on, so that we create our own first modeling code.
So Java 9 platform is divided into a set of modules that are known as platform modules.
So this provides scalable Java Runtime the standard modules have names prefix with Java for example
Java dot base, Java dot sql as well and so on.
And its an example of this course Java FX to create graphical user interfaces.
Now the Jever effects module names are prefixed with Java FX.
Let's see a diagram on the next slide that illustrates the input and output definitions of a module.
So I could see the slide here and get inputs and outputs from a module.
So the much less self definition that we the inputs for the modules as well as the exports which are
packages and then we came down to the module code or internal packages as well as export packages.
So each module comes with a module script to follow and we'll talk more about the module descriptor
for this video.
And as I mentioned we have internal packages and also external packages and also export packages which
can obviously be exported that enables other modules to use export packages.
Alright so every module comes with a module to script to fall that describes the module and contains
meditator about the module.
Now that module script to follow is always located directly at the module root folder and always has
the name module-info.java.
So let's say a minimalistic module descriptor example.
Take a seat on the screen there there's a new keyword introduced module and that's followed by the module
name and curly braces and in this example you can say that I've used academy dot learn programming
dot common as the module name, inside curly braces, as you can optionally add meta data about modules.
In other words inputs and outputs.
But I'll talk more about that later in this section, so module declaration introduces a module name that
can be used in other multiple declarations to express relationships between modules. So module name,
java identifiers separated by a period or dot tokens no different to how you declare a package
and two kind of modules normal modules and open modules.
Now the normal module determines access to the modules types and the members of those types for
code outside the module.
So a normal module without the up and modifier grunt's access at compile time and runtime to tops in
only those packages which are explicitly exported.
Now an open module with the open modifier runs success at compile time tops and only those packages
which are explicitly exported.
However it also grants access at runtime on tops in all its packages as if all packages had been exported.
So let's see a perfect structure with and without modules you can sit in the left hand side got a project
structure as it looked for a java 9 and on the right hand side you've got a project structure with java 9.
Now before java 9 we had a source directory with packages that contained java files but with java 9 is
another directory, module root directory which will contain module info dot java which we talked about
as well as package directories.
Now with Java on much of the programming we don't have to build applications as one big Java project.
We can create much of the units that work together to form an application.
Some modules are ideally components that are reusable that solves specific requirements for that app
so I can think of much higher level packages.
Keep in mind that there are actually not packages.
So in summary project,
so I had the following primary goals, to create a scalable platform and that's to give the ability
to scale the platform down to smaller computing devices.
And I achieved that by moving from a monolithic runtime.
The second goal was security and maintainability it to make it more maintainable pet from code base
that had better organization and also has its internal API hidden so that we've got better much better
interfaces to improve platform security.
Third goal was improved application performance so a platform that smaller with only the necessary run
times which then results in faster performance and number for easier development experience.
So it's a result of the module system and the much of the platform combination.
It's made it easy for developers to create applications and libraries.
So let's move on to the next video.
We've got to look at the much declaration and statements.
So see you in the next video.