Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Sybex 815/816/817/819 OCP Study Guides -- root directories for modules

Saloon Keeper
Posts: 1343
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This isn't specific to any one page or example, it was something I found more than a little confusing about all the material on modules.

Besides for the command line options and which ones apply to which commands, one area to get confused or lost about is the required or recommended or optional parts of the directory structures.

The books follow a pattern where at some root directory for the whole Kit and Kaboodle, there is a mods directory, as well as a root directory for each module.

Now, the following two parts to be quoted make very clear that the name of one of them is chosen arbitrarily, but so as to avoid confusion, and also does not make clear that the naming of the other one follows the same pattern:

Jeanne and Scott wrote:In particular, feeding is the module directory, and the module-info file is directly under it.
Just as with a regular JAR file, we also have the zoo.animal.feeding package with one sub-folder per portion of the name.
The Task class is in the appropriate sub-folder for its package.

Also, note that we created a directory called mods at the same level as the module.
We will use it for storing the module artifacts a little later in the chapter.
This directory can be named anything, but mods is a common name.
If you are following along with the online code example, note that the mods directory is not included, because it is empty.

If someone isn't clear after this that mods is arbitrary in the sense that none of the Java tools enforce the name, but that we called it mods by convention so the humans won't get confused, they either rushed thru or are having issues with reading comprehension.  It couldn't possibly be clearer.

However, the notion that similarly, the root directory of each module could have been called by the module name, which I have since seen elsewhere, or module1, module2, module3 etc., or in fact, if we wanted to be confusing, john, paul, george and ringo, was less clear to me.  I eventually figured it out, but had my Unsure Flag set during a lot of the reading of the chapter.
The names arbitrarily chosen for the base directory of each module appear in all of the javac and jar creation commands, but in none of the commands for working with the .JAR artifacts themselves, as the name of the module's root directory is not exposed anywhere in the .JAR once it is created.

It seems very minor as I type this, but with my brain on heightened alert for file and directory name requirements, conventions and arbitrary choices I was indeed confused about the category of the name of the root directory for each modules source contents thru the whole read of the chapter.  A few extra words about this right up front, similar to the advisory about the name mods, would have prevented such confusion on my part.  I did see at least one other post about this point, but it is not clear how seriously the average reader takes the right/privilege/responsibility of feedback on minor points of confusion.
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic