Build tools can help, if you let us
Brian Fox
brianf at infinity.nu
Thu Apr 6 20:07:06 UTC 2017
I replied on the expert list but it bounced off the moderation. Since this
is a topic that affects everyone, I'm republishing my thoughts (only) here:
-----
Our users are your users and therefore our interests should be absolutely
aligned. Our users won't tolerate the build tool doing something completely
stupid.
The ability for build tools to adequately support the jigsaw efforts will
be key to driving adoption, so lets take a step back and analyze the
situation.
It's hopefully not controversial and we should be able to agree that in an
ideal world, filename is not the best default module name...however for a
legacy jar without any other mechanism, you feel there's there's no other
choice. In other words, there's no metadata that can be convincingly used
to indicate the author's intended module name.
We disagree on the priority of a "beautiful" name vs a properly name spaced
and unique one. You prefer the former, I prefer the later (although
generally I am a neat-nick on naming, it's just a case of priority for me
in this case). Fine, set that aside for now.
The guidance in your last proposal was to block publishing of libraries
that depend upon automodules. This is largely impractical in the real
world, but lets just assume there's a way to dis-incent library creators
from depending upon an automodule. The problem with this is that no library
creator can ever fully modularize until ALL OF his/her dependencies have
also done so.
With an ecosystem that has transitive dependencies sometimes dozens to
hundreds of layers deep and with some of those very deep dependencies quite
stable and infrequently updated, this will take an eternity before the
ecosystem can get over this hump.
*The build tools can help this migration from the old world to the new one,
but you must let us help.*
The vision that I had behind the Module Name was simply that we could make
it easy for module authors starting nearly immediately to choose their
module name. (There is disagreement within Maven committers over defaulting
this, so I seem to be in the minority of this and I think you don't have to
be afraid because of that.) We can make choosing and declaring a name easy,
maybe even required very soon for library authors. That means that we can
start to build up the very metadata that is missing and forcing you to lean
only on filename as the default. We can do so starting now, and by the time
jigsaw starts to hit critical mass, there will hopefully be very few
important libraries that aren't already properly named _by their authors_
as you intend.
The bar to picking a good name is clearly much lower than fully
modularizing...especially if you are barred or shamed into doing so before
all your dependencies have. If you both require that someone is fully ready
to modularize their own library (and their users are equally ready and
willing to upgrade to Java9) and after their dependencies have gone first
before you let someone declare their chosen name in a stable way... well
you're going to be waiting a long time. Maybe forever.
On the contrary, if people start declaring their Module-Name now, and the
rule against automodule dependencies is redefined such that it's ok to lean
on something with a Module-Name, it becomes very easy and very quick for
the ecosystem to get to a sane building point for full modularization.
Without the Module-Name metadata or some equivalent, you are effectively
barring all the build systems from helping with the conversion to achieve
the very goal of this entire process.
--Brian Fox
More information about the jigsaw-dev
mailing list