views:

896

answers:

7

I downloaded IntelliJ IDEA and started with the 30 day evaluation.

Now I'm just wondering, why should I use IntelliJ for plain old java developement (so no Hibernate, JSP, etc)? It doesn't look that different from eclipse or NetBeans, so I hope some IntelliJ guru can give some examples of things IntelliJ can do to justify investing the money in it. I'm trying to use the evaluation to it's fullest and don't want to miss an important feature.

A list of things possible in IntelliJ but not in eclipse is already available, but I'm more interested in the daily workflow than some obscure features that will be used twice a month.

A: 

I'm not an IntelliJ IDEA guru but what the fanboys usually like about IntelliJ are the great refactoring and code assist features. They often claim this product is far superior to its competitor from this point of view.

Personally, I'm a partisan of the following principle: use the IDE with which you feel the most productive, not the one somebody else prefer.

Pascal Thivent
+1  A: 

I've just moved back to Eclipse after 2 years with Intellij (due to a client's preferences).

I'm finding Eclipse to be less helpful. I know that's a nebulous term, but Intellij's feedback was clearer, the UI gave me better information on what was going on, the automatic building seemed more seamless. The project setup/configuration seems more intuitive.

This is perhaps subjective, but sometimes that's why you prefer one over the over. It just feels that little bit slicker, that little bit friendlier...

(I don't think the VIM plugin for Intellij is better, but that's another story!)

Brian Agnew
+9  A: 

I've been using IntelliJ for about 5 years now (since version 4.5) and I also read through most of the Manning book "IntelliJ in Action" and I still wouldn't consider myself a guru on it. In fact, I also wanted to do "plain old Java development" with it, and honestly I have to say that it's quite good at that. Like the other answers, I can only say that there's a definite edge in it's helpfulness that really puts it over the top. We use Eclipse here at work also, and while I don't have as much experience, I can tell you that there are definitely a lot of basic things lacking in it. I put in some serious time and effort to learn Eclipse, looking up how to do the everyday sorts of things I take for granted in IntelliJ, and they're mostly not there or very poorly implemented. The refactoring stuff is definitely the thing that helps a lot.

Aside from the refactoring, I think there are just a ton of small touches that really make this helpful. I think an example might help clarify...

Try this:

Create a new, empty class. Move the cursor inside the braces and do psvm and hit Ctrl-J - this expands the "psvm" into "public static void main(String[] args)". There's a whole list of commonly-used idioms that this shortcut will handle (and it's configurable, too). Inside the main code block, enter this code:

public static void main(String[] args) {
  int x = 1000;
  sout
}

At the end of "sout", do Ctrl-J again - you'll see another popup that let's you choose from some different expansions, but in general this expands to "System.out.println("")" and helpfully puts the cursor between the double-quotes (it's small touches like this that really make it shine, I think. Compare with Visual Studio's "IntelliSense" - a total crock if you ask me).

Anyway, backspace over the first double-quote - notice it deletes the matching double-quote? It does the same thing with braces and brackets, too. I think there are a few corner cases where I prefer it doesn't do this, but the large majority of the time it helps a lot. Back to the code editing: just type x so the code now looks like this:

public static void main(String[] args) {
  int x = 1000;


  // add a few blank lines here too - the need for 
  // this will be obvious a little later

  System.out.println(x);
}

Now, move the cursor over to the declaration of x, and do Shift-F6 - this is the refactoring in-place dialog (I dunno what to call it, so I just made that up). The name "x" gets a colored box around it, and you can start typing a new name for it - as you type, all uses of that name get dynamically updated too. Another neat touch I really like.

Try this: put a really long line comment somewhere, like so:

// this is a really long comment blah blah blah i love to hear myself talking hahaha

Now say you decide the comment is too long, so you move the cursor to the middle of it somewhere and hit Enter. IntelliJ will put the remaining portion of the comment with a "// " prepended - it "knows" this is a continuation of the previous comment, so it comments it for you. Another neat touch.

// this is a really long comment blah 
// blah blah i love to hear myself talking hahaha

Another big bonus I like about IntelliJ compared to Eclipse is that it's much less intrusive - I really hated how Eclipse would manage to get popups on top of popups, and mouse focus would be somewhere but keyboard focus is stuck on something underneath, etc. I think it's possible to work in such a way that these sorts of things don't happen, but it annoyed me immensely in the first place. That reminds me, in IntelliJ if you move the mouse cursor over the package or file navigator in the left pane, that panel gets the mouse focus automatically, so I got accustomed to using the mouse wheel immediately to look around. In Eclipse? You mouse over, but focus stayed on the editing pane, so you have to CLICK with the mouse to transfer focus, and then be able to use the mouse wheel to look around. Like I said, it's a lot of small touches like that which help with productivity.

As you code around, pay attention to the left gutter bar for red "light bulb" type symbols on the current line - this is IntelliJ telling you there are possible things it can do. Use Alt-Enter to bring up a small in-place dialog box, and it will tell you what it can take care of automatically. Say you type in a method definition named "getFoo()" and there's no foo member - it will offer to create it for you. Or if you're using a class and call a non-existing method on it like getFoo() - it will offer to create a getter and a member, or a regular method. It's just plain helpful.

Overall, I'd say small touches are not what IntelliJ gurus will really want to talk about, but I really appreciate how these sorts of things are just "well done". They take care of small details so you don't have to spend so much mental runtime checking your own syntax. I think of it as a butler helping me out with my coding - it takes care of small chores for me so I don't have to. Batman has his Alfred, and I have my IntelliJ. All the settings are excruciatingly laid out for you to modify if you like, but it just seems like the defaults are all geared toward improving your productivity, instead of bothering you all the time with really mundane decisions (especially those which you would almost always make the same choice anyway).

There are some definite drawbacks to IntelliJ - the price is a bit high, and it's quite large that it can take a while to load up on a large project. I'm lucky in that my company pays for the license as well as a very nice workstation so it loads up reasonably quick, but your mileage will vary.

weiji
Most of the features you describe as specific to IntelliJ are also present in Netbeans and Eclipse.
JRL
Funny, but most of the examples given here do exist in Eclipse: type main and Ctrl+Space for the main method, type syso (for sysout) and Ctrl+Space for System.out.println(), highlight x and type Alt+Shift+R to rename it... IMO, this confirms that preferring one IDE over another is highly relative to your coding habits, your knowledge of your current environment, and is thus pretty subjective.
Pascal Thivent
Yes, I know. I eluded to that in my answer with the preface "and they're mostly not there or very poorly implemented". Like my joke-comment about chocolate and poop - they're the same color don't mean they're the same.
weiji
Which one is the poop? That's the question. And it is a bit offensive.
Pascal Thivent
Sorry, no intention to offend - but in the first place I'm not saying one IDE is poop and the other is chocolate. If you're offended, you may be taking it too personally then.
weiji
+7  A: 

I have a day job where I use Eclipse (because that's all that is permitted). I also have my own company where I "moonlight" doing contract work and use IntelliJ.

I would say their feature sets are about the same. Pretty much the same refactorings, same code assists, same style of use, etc. Eclipse arguably has better plug-ins, and probably many more, than IntelliJ. IntelliJ just "knows" things right out of the box like Spring and Hibernate, and these things are better integrated than Eclipse plug-ins of similar functionality.

The reason I choose to use IntelliJ when allowed (personally purchased and upgraded several times) is that everything it does just feels cleaner. Its hard to put my finger on it, but the exact same functionality in IntelliJ feels more streamlined and easier to use than in Eclipse - enough that I would pay for it even though there is a full-featured free IDE available.

So, the activities you should do to decide are this: use IntelliJ everyday for all your development tasks for 30 days. Push through the curve of learning new shortcuts and ways of searching, refactoring, etc. and I suspect you will prefer it. If not, Eclipse is still there for you.

SingleShot
The go to line number key binding in eclipse drove me nuts (Ctrl+L, I believe) because it's not like any other Windows app (Ctrl+G). I agree it was all the small things added up that made me jump ship.
Dan
A: 

Why ? It's so easy to answer your question.

Because intelliJ IDEA is not free and Eclipse is free. if you use intelliJ IDEA by evaluation version , in other words you keep and save some money .

But, if you use Eclipse ,it's free for everyone. You can't feel about the "discounting"!

anyway,intelliJ IDEA is better then Eclipse.

Cong De Peng
+2  A: 

2weiji: use Tab instead of Ctrl+J :-) It's much handy :-))
sout then Tab
psvm then Tab
iter then Tab
etc... :o)

Konstantin Bulenkov
Thanks - Tab is indeed very handy. For the default keymap, I think it's better than Ctrl-J. Unfortunately for me, I use a modified emacs keymap, so it seems that in this situation the "Emacs Tab" takes precedence over "Next Template Variable" - is that right?
weiji
A: 

Why use IntelliJ? Because I find it more consistent in it's user interface and more polished. It allows you to keep your hands on the keyboard longer, rather than switching back and forth between keyboard and mouse. As other people have said, it's the little things that add up.

I found the user-intentions functionality a huge time-saver, and the way it reviews the code and suggests optimizations and corrects bad practices. That I can hit Alt-Enter in a lot of contexts and the IDE is able to figure out and insert what should be there. Pesky things like type declarations, optimizing an old-style for-loop to use the new JDK-5 type of loop, removing redundant value assignments or unused variables.

Being able to first type in the usage of a method that doesn't exist, and then hitting a key combination and having the IDE write out the bare structure of the method - huge timesaver. It makes for a better workflow for me, because it allows you to first think about how you'll be using a method, what it looks like when you read it in context.

Refactoring support - this was the big selling point when I first started using it in 2003, and I think it still leads the way (but i hear Netbeans is also pretty good now)

Highly recommend that you have a look at the IntelliJ KeyMap Reference.

Have a look at this discussion for often-used shortcuts: http://stackoverflow.com/questions/294167/what-are-the-most-useful-intellij-idea-keyboard-shortcuts

trafalmadorian