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
| 102594 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

Chance Gold replied on Sun, 2012/03/18 - 10:13pm in response to: Chance Gold

OK looks like it can - cool.

Lund Wolfe replied on Mon, 2012/03/19 - 1:29am

I have always preferred IDEA to Eclipse but not for any of the code completion, debugging features listed in the article.  IDEA has always been reliable and robust.  Maybe it's because it's not a general purpose tool, so it can do what it does very well.  Maybe it's because it's built by fewer, better developers.  Maybe it is better tested.

I suspect the codebase is much higher quality.  IDEA ain't perfect, but I couldn't ask for much more.

Pegman Bouz replied on Mon, 2012/03/19 - 10:16am

Sorry but there is not any holywar between Chuck Norris and Van Damme. Unacceptable!! Unforgivable!!

Chuck norris is the strongest!!!!!!

Chuck Norris understands Van Damme

!!! Deserve my first post!!!

Ronald Miura replied on Tue, 2012/03/20 - 2:19pm in response to: Andrei Solntsev

Eclipse will list the errors in a separate view, not getting in the way, so I can save my files every 5 key strokes.

IntelliJ will jump to the first file that contains errors, breaking my flow, so I can't keep building as often as I save files.

Another IntelliJ thing that irritates me is that it doesn't show the console output when building. It is kind of smart interpreting the output and presenting errors in the errors tab as a list, but I still want to see what Maven printed, because it helps me diagnosing problems. I want to know if it froze when downloading a .pom file, which is trivial when building from the console (or from Eclipse), but impossible in IntelliJ.

That said, it is a pretty good tool. It just didn't fit very well with my tastes/habits.

Philip Herbst replied on Wed, 2012/03/21 - 3:24pm in response to: Ronald Miura

There is a setting under Compiler "Automatically show first error in Editor"

I tend to invoke maven goals directly in Intellij (Maven projects window, not via build command), in this case you see the maven ouput.

 

Mark Bernard replied on Thu, 2012/03/22 - 12:39pm

How old a version of Eclipse are you using? I can't argue number 1 and number 3 but Eclipse has had context sensitive autocomplete for a long time. And since v3.4 it has had suggestive autocomplete that pops up suggestions of local variables or literals before you even type. I also don't find #1 that big a deal. So this is definitely personal opinion not fact.

Mark Bernard replied on Thu, 2012/03/22 - 12:42pm in response to: Lund Wolfe

Once Eclipse reached version 3 it was robust and reliable too. I didn't even like it before version 3. But now I prefer it.

John Jones III replied on Fri, 2012/03/23 - 1:03pm

Bahhh all of this chatter is pretentious!! Just use Vim and enjoy your life again, and the freedom that comes with knowing you're just doing the right thing..

Markus Härnvi replied on Sun, 2012/03/25 - 9:07am in response to: Nico Van Belle

If you are a professional developer, paying $189 is nothing. It is just one or two billable hours. If that would increase your productivity by just 2% it would be worth it. 

Do you think a craftsman would use bad tools from a supermarket? You should have the best tools available.

And for a free IDE I would chose Netbeans over Eclipse. 

 

Sadas Dsada replied on Thu, 2012/10/04 - 8:00am

You are an idiot for ever thinking Eclipse is any good. It is the worst crap ever made. Most basic features are not even supported. 

cedric dutoit replied on Fri, 2013/08/09 - 9:12am

You definitively convinced me. I will continue to use Eclipse. As I never use mouse or shortcuts and I hate to be told what to do by an IDE. Plus I have an old computer and hat to buy for tools.

Jorge Castro replied on Mon, 2013/11/04 - 8:38am

IntelliJ IDEA is a nice IDE, instead Eclipse is a poor ugly and buggy IDE.

So the comparison is anything but fair.

Some people says, if you find a bug in Eclipse then you can fix it, after all, it is open source. MEH!,  I am yet to find a project where one of the task involves to fix the IDE.

Eclipse has a LOTs of plugins, however no more than 10 are worth to install. Also excluding that most plugins may be they are not compatible with our version of Eclipse, also some requires to "hunt" to find it, while exists a unified market but most of the worth plugins are outside of the market.

Also, the Eclipse workspace is a mess.

But my main complain against Eclipse are the bugs, The Eclipse company is not committed to fix the bugs but to add new features (i.e. bloats the system)

pd: ah, i forget a really annoying problem :THE LAG.  In some project i had this problem, Eclipse gave me a lag of 1-5 seconds PER NEW LETTER TYPED.


Comment viewing options

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