Intellij vs. Eclipse: Why IDEA is Better
The one major difference between IDEA and Eclipse is that IDEA "feels context", which effectively makes IDEA intelligent.
Join the DZone community and get the full member experience.
Join For Freeholy 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!
Opinions expressed by DZone contributors are their own.
Comments