• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OCP 17 Study Guide Module migration methods vs Enthuwere question enthuware.ocpjp.v17.2.3680 :

 
Greenhorn
Posts: 25
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody!
After reading the post by @Hans-Joachim Bleichenbacher I really got confused about module migration. And this confusion got REALLY worse when I came into that question from Enthuwere quiz.

Identify true statement(s) about migration. Select one option

1) In bottom-up migration all modules are moved to module-path. (correct answer)
2) In top-up migration all modules are moved to module path.
3) In top-up migration, the required modules are migrated first.
4) Unnamed modules become automatic modules in top-down migration.
5) In both the approaches for migration, classpath can be used.



For answer 1, I would say that, yes at the end of the migration all of the modules are moved to module-path, but during migration we move one module at time. But before conversion we don't have modules but packages and classes, so how can we move theme?
For answer two the explanation is:

In top-up migration you start with the packages that you are most interested in and upgrade them as named modules, without worrying about their dependencies. You put the dependencies either on module-path (to make them automatic modules) or on classpath (to make them part of the unnamed module).


First of all.: what is the top-up method? Couldn't find anything on the Study Guide about that. Anyway I can't get how this method can compile: just taking some "random"  packages (the one I am "most interested in...without worrying about their dependencies"), and turning them into named-modules without specifying his dependencies (requires) will not allow them to get automatic module, as well as it won't be able (as a named-module) to access to classes and jars in the classpath if needed. So how it is supposed to work?
As I don't know what a top-up method is, I don't get the third answer neither..
Fourth answer's explanation:

In top-down migration, classes that cannot be migrated or cannot be upgraded to automatic modules are left on the classpath and they become part of the unnamed module.


That the answer I gave as true, intending it as "Jar packages without a module-info file become automatic modules in the top-down migration". And that was of course a bad interpretation. Anyway, what the explanation says is different from what I got from the Study Guide. For what I remember, the SG didn't mentioned the possibility of files (classes or jar files?) who couldn't be moved to the module-path. It just says that all of the jar files must be moved to the module-path and becomes automatic modules, and then is possible to convert the jar files we own in named-modules using automatic names.

Please help me!!!  
 
Enthuware Software Support
Posts: 4797
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Replied to your question about "top-up" here.

There is no "top-up" method. That's a typo. It should be "top-down".
 
Paul Anilprem
Enthuware Software Support
Posts: 4797
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


But before conversion we don't have modules but packages and classes, so how can we move theme?


Even though the intent of the statement is clear, ideally, the statement should say, "In bottom-up migration, all jars/libraries should be converted to modules and then those modules should be placed on the module-path."


Regarding your doubt about "top-down" method:


Anyway I can't get how this  method can compile: just taking some "random"  packages (the one I am "most interested in...without worrying about their dependencies"), and turning them into named-modules without specifying his dependencies (requires) will not allow them to get automatic module, as well as it won't be able (as a named-module) to access to classes and jars in the classpath if needed. So how it is supposed to work?


The "without worrying about their dependencies" here refers to the fact that you don't have to worry about converting every dependency into a module. As in, you don't have to touch them at all. You can leave them as they are. You need to convert only the part that you are interested in. You will still need to do whatever it takes to convert the part that you are interested in into a module, including specifying the "requires" clauses and putting the rest of the non-modular jars on module-path or classpath (as determined by the jar which you just converted to a module).

Will update the explanation to make it clearer.

thanks for your feedback!
 
Paul Anilprem
Enthuware Software Support
Posts: 4797
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Btw, a detailed explanation is also provided with this question. Not sure if you have already gone through it but it might be helpful to get the complete picture:
test.png
Points to remember about bottom-up and top-down approaches for migration to Java modules
Points to remember about bottom-up and top-down approaches for migration to Java modules
 
Marco Olivi
Greenhorn
Posts: 25
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Paul, for all of your explanations. I had already read the one in the question, but it was in contrast with the mental model I had of migration methods.
Now it's seems it's much much clearer in my head.
Let me understand if I'm getting closer:
- With the Bottom-up method, you need to be in control of all of the classes/packages/jar files, in order to pack all of them in named-modules. At the end of the process, every class in contained in a module-jar file, that is inside the module-path folder.
- You use Top-down method when you are not in control of some classe/packages/jar files, so that you can't convert all of them to named-modules or you just can't move some of them from the class path. So you just convert the packages you own, using automatic-modules as bridges from name-module and the unnamed module. If at the end of the method there are still classes in the class-path, you need to have at least on automatic module to use them.
 
Paul Anilprem
Enthuware Software Support
Posts: 4797
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Marco Olivi wrote:
- With the Bottom-up method, you need to be in control of all of the classes/packages/jar files, in order to pack all of them in named-modules. At the end of the process, every class in contained in a module-jar file, that is inside the module-path folder.


Correct. Just to clarify further, there is nothing like "a module-path folder". There are modules packaged in jars and those jars are specified on the module-path. (Just like you specify jars on the classpath in a regular old style java applications). You may also have exploded modules (i.e. the ones that are not packaged in jar files) and you may specify those folders (under which you have the files of the exploded modules) in the module-path as well.


- You use Top-down method when you are not in control of some classe/packages/jar files, so that you can't convert all of them to named-modules or you just can't move some of them from the class path. So you just convert the packages you own, using automatic-modules as bridges from name-module and the unnamed module. If at the end of the method there are still classes in the class-path, you need to have at least on automatic module to use them.


Correct.
reply
    Bookmark Topic Watch Topic
  • New Topic