Software developer with 10+ years of experience of Java/Scala development. Currently working at Codeborne, a consulting software company based in Tallinn, Estonia, specializing in development of web-based self-service solutions like internet banks, booking systems, enterprise portals and other software. Andrei has posted 2 posts at DZone. You can read more from them at their website. View Full User Profile

Why IDEA is better than Eclipse

03.15.2012
| 93914 views |
  • submit to reddit

Holy war

There are "eternal" questions that have no single correct answer. E.g. what is better: Windows or Linux, Java or C#; who is stronger, Chuck Norris or Van Damme.

One of such holywars is selection of the best Java IDE:

There is a lot of disputes on this topic discussing which of them has more plugins, shortkeys and so on. There is so many differences that it's difficult to decide what of them are the most important. As a result, people typically claim that both IDEs are equal in their capabilities, and choosing of one of them is a matter of taste.

I claim that it is not just a matter of taste. There are objective reasons why

Intellij IDEA (as a Java IDE) is definitely better than Eclipse.

I am not going to compare lot of tiny differences like plugins, shortcuts etc - there is a plenty of blog posts on this topic, like this one: [part 1] [part 2] [part 3]. I am going to show just one major difference between IDEA and Eclipse. Typically, neither IDEA nor Eclipse fans know it. The first ones used to it and cannot imagine that IDE can miss it. The second ones used to live without it and cannot imagine that IDE can do such things. Moreover, Eclipse users typically don't notice this difference when trying IDEA for fun, just because they used to work "in Eclipse mode".

Why am I so confident?

Before I start, let me explain who I am and why is my opinion worth listening to.

I've been working on Eclipse for 5 years, I knew it very well, I wrote plugins for it and sincerely loved Eclipse. Then I switched to another company, and was forced to move to IDEA. After surviving a serious break-up, I finally realized why is IDEA steeper. And now I have been working on IDEA for a couple of years. So I know both IDEs well and can compare them.

The main difference between IDEA and Eclipse

The main reason why IDEA is steeper is: IDEA feels context. That's what JetBrains employees mean when they name IDEA intelligent. What it really means? IDEA indexes the whole your project, analyses everything it has, and even builds the syntax tree. Thanks to it, at any time, wherever you put the cursor, IDEA knows where you are and what can be done there.

Still not clear? Do not worry, it will become clear in the following examples.

This ability to understand the context is expressed in many, many ways, here are just a few.

1. Debugging

As a part of debugging process, we often want to evaluate some expression to see its value. In Eclipse you need to select this expression. It's important to exactly select the whole expression, otherwise Eclipse cannot evaluate it. Now you press Ctrl+Shift+I and see the value of expression.

With IDEA you don't need to select anything. You just put cursor at any place inside your expression (at method hasAttribute in given case) and press Alt+F8. IDEA understands which expression you probably need and shows a dialog window suggesting several possible variants for your expression. You can also edit and immediatelly evaluate the expression in this dialog. Very convenient! After trying this feature, you just cannot debug in Eclipse anymore.

It turns out that both IDEs, in principle, allow you to do the same thing. But with IDEA it's much easier and faster. I'm serious, the difference is huge - it's just Heaven and Earth. In this small dialog window IDEA will provide autofilling, syntax highlighting and everything you need.

2. Autocomplete

Autocomplete is what distinguishes any IDE from the notepad. In this area feeling the context gives IDEA a qualitative advantage. For example, we started writing a line of code:

assertElement(By.id("errorMessage"), vi

and now we want to find what options do we have: what can start with letters "vi".

What IDEA does? Not waiting for any keystrokes, it immediatelly understands that method assertElement wants an Condition class instance as a second parameter, and there is a static variable in class Condition with name visible. And IDEA immediatelly suggests the only valid option:

And what Eclipse does? Alas, it does not understand the context. It does not know that the cursor is located where the second parameter of the method assertElement should place. So when you press the sacred Ctrl + Space, Eclipse simply shows everything in Universe that begins with the letters "vi":

In a beautiful pop-up window we see a lot of pretty-highlighted well-documented useless information. :(

3. Refactoring

Professional programmers are able to be productive using refactorings provided by their IDE. All modern IDE offer a very impressive set of refactorings. But then again, IDEA refactorings are intelligent. They realize what you want, and offer different options that are suitable for most situations.

For example, suppose we have a method assertErrorMessageIsHidden:

public void assertErrorMessageIsHidden() {
  assertElement(By.id("errorMessage"), Condition.visible);
}

 

and we want the String "errorMessage" to come as a parameter to this method.

 

Let's start from IDEA. Put the cursor to any place inside the string "errorMessage", press Ctrl+Alt+P (meaning "parameter"), and IDEA suggests what expression we probably could extract to a parameter:

As soon as the expression "errorMessage" is selected, IDEA suggests several possible names for this parameter.

Wow every month

You will be surprised many, many times at how smart behaves IDEA, offering options for the name of something. It takes into account method name, variable type and even value, and names of such variables in other places, and those names that you gave such a variable before - except that your zodiac sign is ignored. Believe me, you will say: "Wow, IDEA is able to do such thing too?" at least once every month.

And now let's look that Eclipse suggests.

Do not forget: select the entire expression "errorMessage" (always with quotes, or get a wild message "An expression must be select to activate this refactoring"), choose a refactoring "Introduce parameter" (from the menu, there is no hot key) and get about the same result. However, Eclipse doesn't suggest options for a parameter name, but thanks for that.

Conclusion

If we are choosing a Java IDE then Intellij IDEA is definitely better than Eclipse. It's not just a matter of taste. IDEA is objectively better. It lets you to quickly and easily write and change the code, suggests appropriate names, finds the appropriate methods. It does not require you to exactly select the expressions, but guesses what you want to do and how you wanted to name it. IDEA anticipates and suggests.

P.S. Remarks

I claim that IDEA is better Eclipse just as a Java IDE. If you are considering them in some other capacity - such as the IDE for other languages ​​(C++, Python, Scala), or as a platform for building desktop application, Eclipse may very well win.

Actually it follows from their definition. Eclipse has positioned itself as an abstract platform for building anything with plug-ins, and IDEA is positioning itself as a "intelligent IDE for Java". So it is.

For the sake of interest I will try to name some aspects in which the Eclipse is probably better than IDEA:

  • Eclipse looks better (thought, this is a matter of taste). All this fuss about SWT and native controls was worth it. Eclipse looks like a solid well thought-out application with pretty fonts and icons, while the IDEA at first glance looks like a stunt toy with a lame hack icons and awkward Swing interface.
  • Eclipse has a richer project structure support. In IDEA you have a project consisting of modules. In Eclipse you have a workspace consisting of projects which can be closed/opened, grouped and hidden. But do you actually need it?
  • It seems to be easier to write plugins for Eclipse.
  • IDEA uses more resources (memory) than Eclipse. This actually makes sense - because he knows so much.
  • And finally, Eclipse is free. However, IDEA Community Edition is just enough for me.

 

My final recommendation

If you need pretty icons, platform for creating desktop applications, IDE for C++, or you work on an old weak laptop, then Eclipse is problably better choice for you. But if you are a serious Java developer, and you need a fast and convenient tool that helps you focus on the problem instead of distracting, then the IDEA this is exactly what you need.

I hope one more holywar is over today.

Develop with pleasure!

Published at DZone with permission of its author, Andrei Solntsev. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Tech Fun replied on Thu, 2012/03/15 - 4:09pm

yes, it's all about details.

Mileta Cekovic replied on Thu, 2012/03/15 - 6:03pm

I am using IDEA for about 7 years now.

I was also supprized every month discovering some new intelligent IDEA feature. However, after a couple of years, I stopped to be supprized, now I EXPECT my IDE to be intelligent, more then me ;)

Sometimes, very rarely, when I expect IDEA to be smart, and it turns out that it is not, I am disapointed.

That makes me think that coding without IDEA is not possble for me any more :)

Steven Baker replied on Thu, 2012/03/15 - 5:58pm

Community edition really doesnt do all that much and is pretty damn crippled.

 I would never pay for IntelliJ, but I would use it if my employer paid for it.

Personally I prefer Eclipse.

Reza Ghafari replied on Thu, 2012/03/15 - 6:11pm

The title and base of your article and argument is wrong. You can not compare a free/open source product and a commercial one and say that the commercial one is better !

 

Ricky Clarkson replied on Thu, 2012/03/15 - 8:18pm

Reza: Of course you can compare free and proprietary.  Also, he was comparing Eclipse to the free Community Edition of IDEA, none of those features are unique to the Ultimate Edition.

 

SQL statement completion within Java strings, with actual knowledge of the table names in your database is frankly amazing, the code duplication detection in Ultimate is very good, but we don't need to step up to Ultimate to knock the frankly appalling Eclipse off its perch.

Walt Davidson replied on Thu, 2012/03/15 - 8:25pm

I have used the open source community edition and it still works better for me than eclipse does for pure java projects.  The smartness spoken about in this article is still in the free version.

However if you can afford a personal license (really not that much of an investment) then it is definitely worth it. Smart Spring/JEE/JPA Facets and more, dependency matrix - so much gold in it. 

Imagine clicking in your applicationContext and going straight to a bean code.  Or clicking on a little bean icon next to the class name and going straight to the applicationContext it is defined in. There is so much focused smartness in there it really is a treat.

But each to their own. 

Ronald Miura replied on Thu, 2012/03/15 - 9:03pm

One thing I love in Eclipse is that all compilation errors appear immediately, even in other files. In IntelliJ, errors in the same file will be marked, but errors in other files will appear only after manually building the project. This may be a little detail, but it really drives me crazy.

Eclipse makes me feel not like I'm editing text, but manipulating a model.

Andrei Solntsev replied on Fri, 2012/03/16 - 1:33am in response to: Ronald Miura

Ronald, actually compilation errors do not appear in Eclipse immediatelly, but after saving files. 

While Eclipse has "compile-on-save" feature, IDEA has "save-on-compile" feature. Not a big difference. In both IDEs user needs one shortcut to save+compile the code (Ctrl+S or Ctrl+F9). 

Oliver Plohmann replied on Fri, 2012/03/16 - 3:36am

"yes, it's all about details." I like your sarcasm. Made my day start with a laugh ;-). I can understand that a whole lot of little useful features in the end result in more productivity. But there is a big advantage that makes me chose eclipse over other IDEs whenever possible: eclipse has a nice Smalltalk-style class browser named "Java Browsing" (not the regular Java browser which is simply named "Java"). Once you had the opportunity to work with the excellent Smalltalk IDE you really appreciate being able to work with a similar environment when using eclipse. Smalltalk is not only a programming language but also a style of interactive programming. Eclipse reflects this only a little bit, but in Intellij and NetBeans the idea of interactive development is not supported at all as it is not understood at all. Nevertheless, I also like Intellij as many many things are really well done. I also wished they would change to SWT or something. Their Swing IDE does not really convey a feeling of value...

Dirk Estievenart replied on Fri, 2012/03/16 - 3:43am

Actually, Eclipse shows me errors as soon as I type. Sometimes I really get in  "Yeah, I know. I fix it a minute, just calm down" mood, so fast is Eclipse in showing me errors.

I've tried several times to use IDEA, but feel pretty quickly frustrated with it. It's not because IDEA is bad, but because it's so different from Eclipse (and Netbeans for that matter).

I quite like Eclipse and Netbeans, but struggle to learn IDEA. I saw some pretty amazing features in IDEA CE, that make me want to use it, but the learning curve is just too high to get productive if you can only use it occasionaly.

What I propose, if you want to convince people to use IDEA, is to create a set of screencasts, each explaining a particular feature of IDEA. It really helped me to have a set of railscasts (http://railscasts.com) when I had to learn ruby on rails. I don't get why Jetbrains didn't do it (OK, they did, but they mostly suck).

Oh, and please use TDD, otherwise I won't even start to watch it. 

No holy wars, Just convince me by showing the strenghts of your IDE. Make me want to use your IDE.

Jee, I should go into marketing! :-) 

Oleg Varaksin replied on Fri, 2012/03/16 - 3:45am

Andrei, thanks for this article. I agree 100% with you. After using Eclipse for many years and using IDEA last 2.5 years, I only can agree with your opinion "the difference is huge - it's just Heaven and Earth."

Oleg Varaksin replied on Fri, 2012/03/16 - 3:48am

Especially for Web / JavaScript / JSF / Struts / Spring development is IDEA much comfortable. I can jump into message files / bean from XHTML, I can jump into Bean from XML definitions, injected stuff incl. setter / getter are created automatically,  etc. etc.

Alex Collins replied on Fri, 2012/03/16 - 4:30am

It's nonsense to say that this is "objective" - it's arrogant and objectively incorrect to say so. I'm fine with people expressing opinion, but call it that and not try and dress it up as something else. 

Nico Van Belle replied on Fri, 2012/03/16 - 7:14am

IDEA  - Eclipse

 €189  -  €0

If it would not be better, It would not cost that much now would it?

Nicolas Bousquet replied on Fri, 2012/03/16 - 8:37am

I understand that IDEA is better for some things. But Eclipse is better for other things too:

- Eclipse open source version allow all sort of plugins like editing HTML/JS/JSP/Struts/Spring/EJB/hibernate/SQL whatever, it is available. For IDEA, most of theses thing require you to pay for it. Also, if you use some exotic thing, you have also better chance to have a plugin available for Eclipse than IDEA. That's the main point for me.

-  I'am accustomed to Eclipse, and have to use it at work. Essentially because of first reason. I don't want then to spend time learning IDEA... The small gains in IDEA usage doesn't compensate for time loss of learning using a new IDE... There is no enough improvement to justify it... Counting you need to pay for it. This is not I don't want to learn new things. Now I learn emacs. Few months ago I learned VI. But thoses are really different IDEA or Eclipse... Very similar...

- You say IDEA use more resources. That's a big problem for my company where we have huge projects. 

Jammer Man replied on Fri, 2012/03/16 - 8:54am

It's not the tool, but what a man can do with it that counts.

Lance Semmens replied on Fri, 2012/03/16 - 9:01am

From my experience I find that IDEA is ugly. Yes you can change settings here and there but I think it's just putting lipstick on a pig.

IDEA is also very strict on where each window lives. IDEA has made a decision that the project window is top left and that the console window spans the entire IDEA window. This means that if I span IDEA across two monitors that the console must also span both monitors which is definately not what I want. IMO eclipse's window manager is much better. It lets me put each view where I want it instead of dictating it to me.

Steven Goldsmith replied on Fri, 2012/03/16 - 10:05am

I'm surprised that no one mentioned Netbeans. I used Eclipse for years, but have been using Netbeans for about 3 years. I find it's debugging and profiling more elegant than that of Eclipse.

Philip Herbst replied on Fri, 2012/03/16 - 10:28am

@Lance that's simply not true. You can move project view and all other views to left, bottom or right if you want. An you can even split your console (called split mode or float since v10). As a long term eclipse user it was quite a relief to get rid of all those akward perspective changes. And spending a few bucks for quality tool I'm using every day is not a big deal.

Jonathan Fisher replied on Fri, 2012/03/16 - 1:26pm

Wow, awesome writeup! I bet it took a lot of time to do this, thanks

Jean Helou replied on Fri, 2012/03/16 - 1:28pm in response to: Andrei Solntsev

There are exactly two features from eclipse which I miss in intellij idea ultimate: 

- incremental compile preferably on save so I don't have to wait for the IDE to recompile all the stuff I changed before seeing my tests run (in eclipse I can save a file and switch to another while it compiles, thus run is almost always instantaneous)

- a good and working decompiler plugin, preferably integrating http://java.decompiler.free.fr/ I have to look into doing this myself but I still can't believe intellij doesn't do it natively

 This would make intellij the absolute best editor for me. I can possibly live without the first, I won't buy another license until I get the second one. 

Mahmoud Ben Hassine replied on Fri, 2012/03/16 - 4:57pm

What about maven integration?

IMO, it is definitly better in IDEA and is available out-of-the-box in the community edition.

Also,  IDEA project structure (in modules) fits perfectly with maven model.

Many developers using maven with eclipse usually have a separate terminal to run maven commands...

Philip Herbst replied on Sat, 2012/03/17 - 5:59am in response to: Jean Helou

The plugin IntelliJad Plus works for IDEA11 (decompiling and debugging).

The seamless compiling in Eclipse is one of the things which I'm missing in IDEA. I changed my keymap for Command+S to Compile Action and everytime I change a file I press that shortcut (a habit from the old eclipse days). I also changed the java compiler to "Javac in-process" which works faster than the default compiler for me. 

Mykel Alvis replied on Sat, 2012/03/17 - 2:15pm in response to: Mahmoud Ben Hassine

Huh?

Maven integration in the latest eclipse IS out-of-the-box.

Mykel Alvis replied on Sat, 2012/03/17 - 2:24pm

With regard to the OP, this article would have been best served being presented as "Some cool things IDEA does" rather than trying to make a religious argument into an objectve one.  I think IDEA does have some advantages over Eclipse (and vice versa).  For some people, those might be worth the money, but this article in no way ends any debate on the value of one versus another.  

These killer attributes of IDEA are a form of sugar.  Sure, they're nice.  They'll probably be nice in the version of Eclipse that implements them, should such a creature ever appear.  But the real power of an IDE is its ability to make you more productive and none of your examples are things that kill 10's of minutes of productive time in multiple instances across the course of a coding day.  

 

Anton Arhipov replied on Sun, 2012/03/18 - 3:54am in response to: Reza Ghafari

Oh, sure he can. It is the same way the majority says that eclipse is better because it is free. Put the commercial vs oss argument aside and all the arguments above are quite valid.

André Dietisheim replied on Sun, 2012/03/18 - 6:22am

To me you presented features, that bring excellent enhancenent to the daily dev job. But definitely not arguments that would kill Eclipse when compared to IDEA. What IDE you use is a personal decision anyhow. But I'd definitely love to see these ideas implemented in Eclipse and that's what opensource is all about. Better software by collaboration. And this is what makes Eclipse unique compared to IDEA. I can go and fix, enhance, reuse.
Btw. code completion is greatly enhanced in eclipse with the new code recommendrs plugin ( http://www.eclipse.org/recommenders/).
I also missed the task oriented UI you get when using Eclipse Mylyn. Brilliant if your daily job is about doing tickets in some agile process. IDEA has nothing comparable afaik.
But still, this article shows to me that we dont know the competing IDE well enough. There's a lot to get inspired of.
Btw. my daily job is about bringing Eclipse based tooling to jboss users and i am committer on the ecpipse platform

Jean Helou replied on Sun, 2012/03/18 - 8:48am in response to: Philip Herbst

unfortunately, jad is not even close to JD http://java.decompiler.free.fr/ but it might be worth trying again. Last time I tried to install the plugin it wouldn't work. 

Philip Herbst replied on Sun, 2012/03/18 - 8:51am in response to: André Dietisheim

Community edition is opensource 

http://www.jetbrains.org/display/IJOS/Contribute

not as sophisticated as mylyn (was easy to build a plugin for rational change, which we have to use)

http://www.jetbrains.com/idea/webhelp/managing-tasks-and-context.html 

 I agree with you that each tool could learn something from its competitors, not to forget Netbeans! It's a good thing that we have choice in the java/jvm world.

Chance Gold replied on Sun, 2012/03/18 - 9:26pm

Can IntelliJ pick up code changes to html and java files in running web applications w/o a server restart? That is a great feature in Eclipse.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.