geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james_strac...@yahoo.co.uk>
Subject Re: Coding standards: import thing.* or thing.Class?
Date Wed, 13 Aug 2003 16:47:59 GMT
+1 for expand imports. It makes reading the code easier. Code is there 
to be read by humans - so anything which helps comprehension (while not 
going stale like too much documentation can do) is a very good thing.

I often tend to do an 'organise imports' in eclipse when code starts 
having unused imports in it etc.


On Wednesday, August 13, 2003, at 05:44  pm, Alex Blewitt wrote:

> Has anyone got any preferences between using:
>
> import java.util.*
>
> or
>
> import java.util.Vector
> import java.util.Enumeration
>
> etc.
>
> (Yes, I know I should be using List instead of Vector :-)
>
> Despite some articles trying to claim otherwise, there's really very 
> little difference between the two as far as the code is concerned. In 
> fact, you could argue that the import package.Type is actually slower 
> than the import package.* variant as there's more text to be parsed.
>
> The only real difference IMNSO is that if you have
>
> import java.util.*
>
> then this says 'This type is dependent on types in the java.util 
> package"
>
> whereas
>
> import java.util.Vector
> import java.util.Enumeration
>
> says "I specifically depend on Vector and Enumeration in the java.util 
> package"
>
> People who use powerful IDEs (i.e.,they write the import statements 
> for you) generally prefer the more verbose and detailed import types; 
> those using text editors will no doubt prefer to use the package 
> wildcards.
>
> Any votes on which one is better/worse/standard?
>
> Alex.
>
>

James
-------
http://radio.weblogs.com/0112098/


Mime
View raw message