Vita Rara: A Life Uncommon

How I Got Over "import java.util.*;"

Categories: |

It's taken me years, but I finally got over import java.util.*;. First, I don't use an IDE. I know an IDE could manage my imports, but I'm not an IDE guy. So, for years I've managed my imports manually, or given up and done import java.util.* and felt guilty about it. Well, I'm over that, and I can give Groovy the credit. By default Groovy imports java.util.*. I've been using Groovy every day now for about a year and a half and the house is still standing, our code compiles, we haven't had name conflicts. Things work, and it's a lot easier.

I used to worry about name clashes and compilation speed, and other shiboleths spoken of around coder camp fires and in hushed tones. After all everyone "knows" that the * should be avoided. Well, I'm over it, import java.util.* is just fine with me. Now when I start a Java source file I almost always just add java.util.*.

java.util.* is one of the most frequently used packages in my code. I don't want to spend mental time managing imports, and no I'm not going to an IDE, at least not now. So, it's import java.util.*. Hey, I even do import javax.persistence.* from time to time now! Oh me oh my!

Compile Speed?

Can anyone give me any actual metrics that show compile speed is significantly impacted by using *, even in a package the size of java.util?

~~ Robert.

Not an IDE guy?

Umm.... why not?


Well, for me it comes down to a few things, speed and stability being the leading ones. I used to do a lot of PHP development on remote machines. I used screen and vim. This combination has never ever let me down and it works everywhere I need to work. I've yet to find an IDE that has the rock solid stability of screen and vi. Add in a build tool like ant or maven and I have everything I need. Need being operative word.

I'd like some of the bells and whistles that IDE's provide. I've tried. Believe me I've tried to move away from screen and vim plus a build tool. I've tried Eclipse three times, and I've recently tried NetBeans twice for use in a Rails project.

Eclipse three times corrupted its workspace to the point of no recovery. (I've been using screen and vim for 13 years and have never lost work, not even 15 minutes worth.) Two of those corruptions were after a long afternoon of work, work which would have been inappropriate to commit to our version tracking system until it all worked, all of which I lost and had to redo from memory. The first two times I justified it and tried Eclipse again, the third time I'd had enough and went back to screen and vim.

My attempts at NetBeans were ultimately off putting because it is slow. I use a Mac Pro quad Xeon with 4GB of RAM, and it was slow on that machine! I can't imagine what it would be like on slower machines. Plus the GUI is just plain buggy on OS X. (I can only move one direction between open tabs using a keyboard shortcut. Huh?)

My experiments with Rails did introduce me to an editor that is about as close to an IDE as I've used in recent years, TextMate. I can highly recommend TextMate to any OS X user out there. It's a great editor. It's stable, fast, extensible, and integrates well with OS X. I've tweaked the Java, Groovy and Ruby bundles to my liking, and worked out a color scheme I like. I've been using TextMate everyday for the past few weeks and really like it. If only someone could make an IDE that worked like TextMate I'd sign up for it.


Hmmm. Thats something I could never do.
Over the years, I have come to rely on Eclipse so much that I find the mere thought of changing to another IDE distinctly discomforting.

I must say I have never lost even a minute's work with Eclipse. And the combination of the Web Tools Platform, Tomcat and SVN plugins and Ant is deadly. At times, during hours of pressure and intense coding, I have almost experienced what could be "push-button" app development. And on my 3GB-2GHz Lattitude, it works like lightning.