Re: [jgrapht-developers] Jalopy update
Brought to you by:
barak_naveh,
perfecthash
From: John V. S. <js...@gm...> - 2005-09-05 20:51:06
|
I've heard the argument below often, but I've used the import pkg.* convention on many projects before without any such troubles. In particular, the Farrago project has a jillion dependencies on third-party libraries. And when I upgrade one of them, I commonly have to deal with semantic mismatches, but only very rarely with namespace collisions, which are very easy to detect and resolve anyway. I don't see why it would be any different for your intrepid JGraphT user charging off into JDK 1.6 or a new release of JGraph: the real pain during an upgrade always comes from semantic changes. Interestingly, the Sun JDK source code uses a mix of the two conventions. Let's leave this up to the maintainer's preference; when the time comes for me to hand off the torch, the next maintainer can review this convention. Or if users start swearing at us, then we'll review it sooner. :) JVS Barak Naveh wrote: > I still think the explicit list of import is preferable. To be > argumentative, modern IDE's do indeed show where the class is coming from, > but they also do clever folding :)... One can automatically unclutter the > import list by letting the IDE fold it (I think it's even the default in > Eclipse)... > > But now seriously; I have a better reason. > Import such as java.util.* "contaminates" the namespace with unrelated > classes that might cause name collision. To demonstrate how this > contamination can cause problems, let's suppose that Sun adds a > java.util.UndirectedGraph interface in jdk 1.6, and let's also suppose, that > JGraphT, for good reasons, does not immediately upgrade to 1.6 (we know it > took a while to update to 1.5). > > Now, we, in JGraphT, program against 1.5 so everything compiles cheerfully, > passes the unit tests, and we're happy and proud. An enthusiastic developer > who has already rushed to use 1.6 downloads JGraphT, attempts to compile it > and... starts swearing... The import section of, say, AbstractBaseGraph, > contains: > > import java.util.*; > import org._3pq.jgrapht.*; > > which leads to a name collision -- the code doesn't compile. > > If a name collision with Sun sounds imaginary, a collision with JGraph > wouldn't be that hard to imagine. Anyway, the use of wildcards for imports > (regular or static) can cause problems that happen only in the "field" and > can easily escape detection and correction in the "lab". After painfully > experiencing such problems, one is compelled to decide to never again use > wildcards for imports, static or otherwise. And if the clutter could be > easily handled by the IDE, the decision comes with no sacrifice... > > Would you reconsider? > > Barak > > > > |