You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2003/02/27 16:14:43 UTC

cvs commit: xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers SourceProperty.java

cziegeler    2003/02/27 07:14:43

  Modified:    src/blocks/slide/java/org/apache/cocoon/components/source/helpers
                        SourceProperty.java
  Log:
  Removing unused imports
  
  Revision  Changes    Path
  1.3       +1 -5      xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers/SourceProperty.java
  
  Index: SourceProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers/SourceProperty.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SourceProperty.java	15 Feb 2003 22:56:25 -0000	1.2
  +++ SourceProperty.java	27 Feb 2003 15:14:43 -0000	1.3
  @@ -54,17 +54,13 @@
   import org.apache.cocoon.xml.dom.DOMBuilder;
   import org.apache.cocoon.xml.dom.DOMStreamer;
   import org.apache.excalibur.xml.sax.XMLizable;
  -
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  -
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   import org.xml.sax.helpers.AttributesImpl;
  -
  -import org.apache.xml.serialize.*;
   
   /**
    * The interface for a property of a source
  
  
  

Re: cvs commit: xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers SourceProperty.java

Posted by Berin Loritsch <bl...@apache.org>.
Nicola Ken Barozzi wrote:
> 
> Sorry guys, I'm really ignorant, but what is the technical reason why 
> removing unused imports is a good idea?

Simple, classloader resolution issues.

Every import causes the classloader to try to resolve a class because
the loaded class may use them some time during its life.  I have run
into this before.  If you have an import for javax.mail.Session, then
you need to have that class in your classpath--even if it is never used.
This is true for JDK 1.4.1 at least.

One thing that I have done in the Excalibur DataSource package is to
use reflection to soften dependencies for the InformixDataSource
class.  Otherwise, the class will refuse to load because the Informix
jars are not found.  Now it catches that issue at configuration time,
but the class can still be loaded at init time.

Sooner or later those imports will bite you in the butt.  Esp. when one
of those stale imports reflects a class that no longer exists.  You
will fail to compile it.


Re: cvs commit: xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers SourceProperty.java

Posted by Peter Royal <pr...@apache.org>.
On Thursday, February 27, 2003, at 10:55  AM, Stefano Mazzocchi wrote:
> Eclipse's concept of a java DOM is a kickass concept exactly for this, 
> you can move methods around or rename them and eclipse knows already 
> all the dependencies and can update all your code on the fly.
>
> No other IDE is so advanced in terms of development paradigms.

Have you tried IDEA from IntelliJ? http://www.intellij.com

Not free, but kickass.
-pete


Re: cvs commit: xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers SourceProperty.java

Posted by Stefano Mazzocchi <st...@apache.org>.
Nicola Ken Barozzi wrote:
> 
> Sorry guys, I'm really ignorant, but what is the technical reason why 
> removing unused imports is a good idea?

No technical reason, it just keeps things clean since you can look at 
those imports and *really* find out if this class depends on it or not.

I use to grep for the java class to find out class dependencies, it was 
very useful when moving things around.

If we leave unused imports around, or worse, use the horrible 
java.util.* syntax sugar, refactoring becomes *MUCH* more difficult 
because you have to dive into the code to find out.

Eclipse's concept of a java DOM is a kickass concept exactly for this, 
you can move methods around or rename them and eclipse knows already all 
the dependencies and can update all your code on the fly.

No other IDE is so advanced in terms of development paradigms.

In fact, it's good old Erich Gamma who designed it :)

Compile-first paradigms makes it a pain to enter the environment with a 
preexisting project (as it happened for us), but it really kicks ass in 
the long run. Think of a continous integration for yourself type of thing.

Now, if only used less memory I could use it on this ronzputer of mine 
for bigger stuff than Agora :,-(

-- 
Stefano Mazzocchi                               <st...@apache.org>
    Pluralitas non est ponenda sine necessitate [William of Ockham]
--------------------------------------------------------------------



Re: cvs commit: xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers SourceProperty.java

Posted by Vadim Gritsenko <va...@verizon.net>.
Carsten Ziegeler wrote:

>It's simple: it increments your cvs commit counter, so you can get
>cvs committer of the month! And I think this is very reasonable :)
>
>Technical reasons: Compilation is faster (by 0.001 ms) as the unused
>imports don't have to be resolved.
>
>Apart from that, the real reasons are all those nice little tools looking
>at your code and complaining about wrong coding style, using deprecated
>methods, having unused imports/statements etc. So the real reason is to
>keep those tools happy.
>
>Or has someone else a better explaination?
>  
>

Only one small addition: to look good on the reports from those nasty 
little tools! :-)

http://cvs.apache.org/~tcopeland/jakarta_bad_imports.htm
http://cvs.apache.org/~tcopeland/pmdweb/


Vadim


>Carsten
>
>  
>
>>-----Original Message-----
>>From: Nicola Ken Barozzi [mailto:nicolaken@apache.org]
>>Sent: Thursday, February 27, 2003 4:25 PM
>>To: cocoon-dev@xml.apache.org
>>Subject: Re: cvs commit:
>>xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/he
>>lpers SourceProperty.java
>>
>>
>>
>>Sorry guys, I'm really ignorant, but what is the technical reason why 
>>removing unused imports is a good idea?
>>
>>Thanks :-)
>>



RE: cvs commit: xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers SourceProperty.java

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
It's simple: it increments your cvs commit counter, so you can get
cvs committer of the month! And I think this is very reasonable :)

Technical reasons: Compilation is faster (by 0.001 ms) as the unused
imports don't have to be resolved.

Apart from that, the real reasons are all those nice little tools looking
at your code and complaining about wrong coding style, using deprecated
methods, having unused imports/statements etc. So the real reason is to
keep those tools happy.

Or has someone else a better explaination?

Carsten

> -----Original Message-----
> From: Nicola Ken Barozzi [mailto:nicolaken@apache.org]
> Sent: Thursday, February 27, 2003 4:25 PM
> To: cocoon-dev@xml.apache.org
> Subject: Re: cvs commit:
> xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/he
> lpers SourceProperty.java
> 
> 
> 
> Sorry guys, I'm really ignorant, but what is the technical reason why 
> removing unused imports is a good idea?
> 
> Thanks :-)
> 
> cziegeler@apache.org wrote, On 27/02/2003 16.14:
> > cziegeler    2003/02/27 07:14:43
> > 
> >   Modified:    
> src/blocks/slide/java/org/apache/cocoon/components/source/helpers
> >                         SourceProperty.java
> >   Log:
> >   Removing unused imports
> 
> 
> -- 
> Nicola Ken Barozzi                   nicolaken@apache.org
>              - verba volant, scripta manent -
>     (discussions get forgotten, just code remains)
> ---------------------------------------------------------------------
> 

Re: cvs commit: xml-cocoon2/src/blocks/slide/java/org/apache/cocoon/components/source/helpers SourceProperty.java

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Sorry guys, I'm really ignorant, but what is the technical reason why 
removing unused imports is a good idea?

Thanks :-)

cziegeler@apache.org wrote, On 27/02/2003 16.14:
> cziegeler    2003/02/27 07:14:43
> 
>   Modified:    src/blocks/slide/java/org/apache/cocoon/components/source/helpers
>                         SourceProperty.java
>   Log:
>   Removing unused imports


-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------