geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject Re: Coding standards: import thing.* or thing.Class?
Date Thu, 14 Aug 2003 02:53:53 GMT

People [ie) me] using text editors a lot prefer the explicit import rather
than wildcard. You ever looked at:

import com.foo.util.*;
import com.foo.prod1.*;
import javax.swing.*;
import java.util.*;
import com.foo.ejb.*;

and then seen a class called 'BeanHelper' in the code and thought 'WTF!'.

S'nightmare :)

On a sitenote, someone ought to use Geronimo as a "religious arguments you
can have while setting up a Java project" template. Though to the credit
of the community, it's all moving smoothly.

Hen

On 13 Aug 2003, Hiram Chirino wrote:

> +1 for expanded imports.
>
> Regards,
> Hiram
>
> On Wed, 2003-08-13 at 12:47, James Strachan wrote:
> > +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/
> --
> /**************************
>   * Hiram Chirino
>   * Partner
>   * Core Developers Network
>   **************************/
>


Mime
View raw message