Thread: [jgrapht-developers] Jalopy update
Brought to you by:
barak_naveh,
perfecthash
From: John V. S. <js...@gm...> - 2005-09-05 04:10:32
|
One of the things we lost in moving JGraphT to JDK 1.5 was the ability to use the old open-source version of Jalopy. To keep things simple, I have purchased a copy of the commercial one and will run it myself. So, you don't need to worry about running Jalopy before checkin; I'll get around to modified files sooner or later (at least before each release). I just checked in a reformat of the entire codebase. As part of this, I changed the settings to match my style preferences in order to make my maintenance job easier. Probably the most controversial change is to collapse imports (e.g. import java.io.*) instead of expanding them. These days IDE's all make it easy to see where a class is coming from wherever it is used, so I don't think maintaining the class-level clutter at the top of the file has any benefit. JVS |
From: Barak N. <ba...@3p...> - 2005-09-05 12:05:34
|
> One of the things we lost in moving JGraphT to JDK 1.5 was the ability > to use the old open-source version of Jalopy. To keep things simple, = I > have purchased a copy of the commercial one and will run it myself. = So, > you don't need to worry about running Jalopy before checkin; I'll get > around to modified files sooner or later (at least before each = release). Btw, I think there is a cool feature of Jalopy that allows running it on = the server-side as a pre-checkin script. If applicable, it could be useful = -- that is, transparently format the code whenever a developer checks in.=20 > I just checked in a reformat of the entire codebase. As part of this, = I > changed the settings to match my style preferences in order to make my > maintenance job easier. Probably the most controversial change is to > collapse imports (e.g. import java.io.*) instead of expanding them. > These days IDE's all make it easy to see where a class is coming from > wherever it is used, so I don't think maintaining the class-level > clutter at the top of the file has any benefit. 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)... =20 But now seriously; I have a better reason. =20 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).=20 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. =20 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=20 |
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 > > > > |
From: Barak N. <ba...@3p...> - 2005-09-06 11:35:22
|
> 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. :) Ok, sure :) Barak |
From: John V. S. <js...@gm...> - 2005-09-12 18:09:37
|
Some breaking news: there's a new open-source release of Jalopy available, and it has been upgraded to support JDK 1.5! This is a great example of the open-source model working: the project was abandonded when the original author created a closed-source fork for commercial purposes, but because enough people still needed an open-source version, others stepped in to revive it. I'll experiment with the open-source release to see if it's stable enough. JVS John V. Sichi wrote: > One of the things we lost in moving JGraphT to JDK 1.5 was the ability > to use the old open-source version of Jalopy. To keep things simple, I > have purchased a copy of the commercial one and will run it myself. So, > you don't need to worry about running Jalopy before checkin; I'll get > around to modified files sooner or later (at least before each release). > > I just checked in a reformat of the entire codebase. As part of this, I > changed the settings to match my style preferences in order to make my > maintenance job easier. Probably the most controversial change is to > collapse imports (e.g. import java.io.*) instead of expanding them. > These days IDE's all make it easy to see where a class is coming from > wherever it is used, so I don't think maintaining the class-level > clutter at the top of the file has any benefit. > > JVS > |