Page 1 of 1

About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sun Apr 18, 2021 6:17 am
by 61d14837
Please confirm if I understand this concept correctly. In the real world, I would employ the top-down migration strategy because I don't have access to mysql-connector-java.jar The datalayer.jar may belong to the same company but another team could own that project.

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sun Apr 18, 2021 8:07 am
by admin
That is correct.

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sat Feb 05, 2022 1:58 am
by gayanw
What if I modularize only the myapp.jar and leave data-layer and mysql-connector-java on the classpath. Will it work?

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sat Feb 05, 2022 3:39 am
by admin
No, classes in explicitly named modules cannot access classes from jars on classpath. Only automatic modules (which are implicitly named modules) can do that. So, you need to use automatic modules. Please go through a good book to understand this concept. We recommend the modules chapter of Hanumant Deshmukh OCP Java 17/21 Fundamentals study guide.

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sun Feb 06, 2022 1:51 am
by gayanw
Thanks for the info.

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Mon Nov 14, 2022 10:51 am
by aPerson
Does the question mean: how can you make myapp modularized with as few steps as possible, starting at the bottom? Would leaving mysql as it is, making datalayer automatic and myapp modularized be a good answer to that? Or is the premise of the question that mysql and datalayer should be modularized (either automatic or regular)?

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Mon Nov 14, 2022 12:12 pm
by admin
The problem statement says that you have to use the bottom-up approach to modularize your app. If you use automatic modules then you are not using bottom-up approach (you are using top-down approach). The concept of automatic modules is created solely for the top-down approach.

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sat Sep 21, 2024 1:47 pm
by usermanguy
@admin
Scott and Jeanne's book directly states, and I quote: "Unnamed modules do not export any packages to named or automatic modules" and in table 17.3 write "An unnamed module is readable by other modules on the module path?: NO"

This is in direct conflict with what you state about the alternative to this question, using a top-down migration where you for some reason leave the mysql package on the classpath.

According to the book's definition of a top-down migration, the first step is to migrate *all* modules to the module path, making them automatic modules, and then one at a time giving them module-info files. How come you suggest leaving one on the classpath? Are Scott and Jeanne just dead wrong on the entire Modules chapter?

I will also say that most resources I can find on the internet clearly specify that any module on the module path *cannot* see modules on the classpath.

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sat Sep 21, 2024 8:00 pm
by admin
That book is wrong. Not only the part that you have quoted is incorrect several other points in that book are incorrect. Please check with the authors of that book or check their errata page.

Our explanation is correct. You may confirm from the source: https://openjdk.org/jeps/261

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sat Sep 21, 2024 8:02 pm
by admin
>I will also say that most resources I can find on the internet clearly specify that any module on the module path *cannot* see modules on the classpath.

If you read that, then you are reading unreliable material. Because this rule does not apply to automatic modules. They can read everything including classes in the unnamed module. That is the whole point of having automatic modules.

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sat Sep 21, 2024 8:04 pm
by admin
Suggest you to go through the modules chapter of Hanumant Deshmukh OCP Java 17/21 Fundamentals study guide. Costs only $2.99 but explains these (and several other) points correctly.

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sun Oct 20, 2024 2:01 am
by anthonysk0210
why option 3 "The mysql jar must first be converted into modular jar. The datalayer.jar need not be converted." is not the correct answer?

Re: About Question enthuware.ocpjp.v11.2.3427 :

Posted: Sun Oct 20, 2024 5:39 am
by admin
You do not own mysql.jar . How will you make it modular? It is a third party jar.
Please go through the responses above.