Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between ResolvedModule, Module and Observable Module

The documentation for each of these states following:

ResolvedModule

A module in a graph of resolved modules. ResolvedModule defines the configuration method to get the configuration that the resolved module is in. It defines the reference method to get the reference to the module's content.

Module

Represents a run-time module, either named or unnamed.

Q:- When does these two differ, is it at the compile and the run time or is it just different representation of a module?

On the other hand, the module-path defines

The modules built-in to the compile-time or run-time environment, together with those defined by artifacts on the module path, are collectively referred to as the universe of observable modules.

Q:- Are all these related? Could someone please draw an example of how and at what time to explain the concept?

like image 336
Naman Avatar asked Sep 20 '17 19:09

Naman


People also ask

What is the difference between promise and Observable?

The biggest difference is that Promises won't change their value once they have been fulfilled. They can only emit (reject, resolve) a single value. On the other hand, observables can emit multiple results. The subscriber will be receiving results until the observer is completed or unsubscribed from.

What is the difference between promise and Observable in Angular?

Promises deal with one asynchronous event at a time, while observables handle a sequence of asynchronous events over a period of time. Emit multiple values over a period of time. Emit a single value at a time. Are lazy: they're not executed until we subscribe to them using the subscribe() method.

What is the difference between subject and Observable?

In comparison to a regular Observable, a Subject allows values to be multicasted to many Observers. A Subject and its subscribers have a one-to-many relationship. A Subject can be an Observable as well as an Observer. They hold a registry of many listeners to multiple Observables.


2 Answers

Start with the java.lang.module package description where resolution is specified and you will learn about readability and readability graphs.

Then look at the Configuration class as a Configuration object encapsulates a readability graph. Each vertex in the graph is represented by a ResolvedModule.

Once you have a Configuration then you can think of instantiating it as a graph of modules in the Java Virtual Machine. This will lead to you the java.lang.ModuleLayer API.

I think part of the question is asking if there is a 1-1 relationship between the model world ResolvedModule and the run-time Module. Usually yes, but there is nothing to stop you instantiating a Configuration multiple times which will result in several module layers created from the same configuration.

It's probably too much to be thinking about now, best to digest the design and API before going there.

like image 153
Alan Bateman Avatar answered Sep 26 '22 20:09

Alan Bateman


If you're looking for an answer that describes the use of these specific classes, I'm out of my depth, but this is the meaning of these terms in slightly less technical context:

  • Module: colloquially used to describe anything modular artifact (modular JARs or JMOD)
  • Observable Module: module in the runtime image or the on the module path
  • Resolved Module: observable module that was added to the module graph during module resolution
like image 25
Nicolai Parlog Avatar answered Sep 22 '22 20:09

Nicolai Parlog