commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <ggreg...@seagullsw.com>
Subject RE: import * vs explicit debate
Date Thu, 03 Apr 2003 02:31:47 GMT
Alex,

Your points are all well taken and I can see things from your POV. It is
indeed a religious issue. I am not convinced though that a given style
should be adopted just to make life better for an IDE. After all, IDEs like
Eclipse are constantly evolving. 

>From my POV, there is so much "junk" in the header (pages of license texts,
comments, imports, other comments) at the top of most files that when I am
in "normal" programming mode, I skip it all to get to the type decl or
below. So 10 lines or imports vs. 5 is not an issue, I skip it. _But_, if I
_do_ want to look at the imports, might as well tell me exactly what is
needed by the file.

For example: /Apache Jakarta
Commons/lang/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
version 1.17.

License: lines 1-53
Imports: lines 56-59
Class comment: lines 61-120.
Where's the beef: starts at line 121.

In this example, if we "compressed" the imports we would "save" two (2) line
out of 120 in the header. This is not much of a saving, and if you are on
the religious side of explicit = clarity, then this is this a loss of
clarity.

Religiously yours,
Gary ;-)

PS: Why can't the license text go at the _bottom_ of a file...?

-----Original Message-----
From: Alex Chaffee / Purple Technology [mailto:guru@stinky.com] 
Sent: Wednesday, April 02, 2003 4:41 PM
To: Jakarta Commons Developers List
Subject: Re: import * vs explicit debate


So I don't really mind if the vote goes the other way, but I thought
I'd respond, as nobody else seems to be starry-eyed...  

My main complaint with explicit imports is that is cripples a *very*
handy IDE feature (auto-complete).

On Wed, Apr 02, 2003 at 06:49:35PM -0500, Gary Gregory wrote:
> Here are my pennies: We uses "explicit" imports as computed by Eclipse's
> "Organize Imports" feature. 
> 
> Before saving or committing a file, we (usually) all do a
> CTRL-SHIT-O/Organize Imports and a CTRL-SHIFT-F/Format. (It would be nice
if
> this were done automatically when you save a file, someday maybe.) Eclipse
> uses "explicit" imports, which I personally like for the following
reasons:

Eclipse actually lets you set the threshold wherever you like.  It
will go * after one, two, twelve, or whatever.  Same for IDEA.

> (0) It is clearer, no mysteries.

...until the list gets larger than 7 and then it's back to being
incomprehensible.

> (1) You can see how "involved" or coupled a type is in other packages'
> business.

Well, you can see how *many* packages it's coupled to more easily with
implicits.

But nobody has yet told me how often this is actually useful.  Real
decoupling/refactoring takes actual comprehension of the object model
and semantics; an import list won't help with that.  And if you're
computing coupling there are lots of code metric tools available that
give you arguably more useful measurements (though I've never found
these particularly useful -- instead I refactor as I go and find that
if I visit a module, that's evidence that deserves cleaning).

> And FYI/FWIW:
> 
> "Import statements must be fully qualified for clarity." from
> http://jakarta.apache.org/turbine/common/code-standards.html
> 
> "All import statements should containing the full class name of classes to
> import and should not use the "*" notation" from
> http://jakarta.apache.org/cactus/participating/coding_conventions.html

If the rest of the Apache project jumped off a bridge... :-)

It's a religious issue, I'll give you that.  At least we've all agreed
not to use tabs, right?

-- 
Alex Chaffee                               mailto:alex@jguru.com
Purple Technology - Code and Consulting    http://www.purpletech.com/
jGuru - Java News and FAQs                 http://www.jguru.com/alex/
Gamelan - the Original Java site           http://www.gamelan.com/
Stinky - Art and Angst                     http://www.stinky.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message