My experiences with IntelliJ IDEA

Here I would like to say a few words about my use of IntelliJ IDEA while working on Evolveum midPoint project.

I am a quite conservative man. So that although my colleagues had been positively talking about IntelliJ IDEA for some time, I used Eclipse and didn’t think about switching over. At that time, I had been using it for approximately 8 years. Moreover, I was (and still I am) using it for some other projects, for which I don’t have IDEA license, so I thought it would be best to stick to Eclipse as the only IDE and don’t complicate my life with another one.

However, one day my Eclipse just refused to work with my midPoint workspace. As I was not able to make it working for more than a day, I hesitately decided to try IDEA. With a little help from my colleagues, I was able to start very quickly and after a few days I was fully used to it.

Today, after 2-3 years of working with IDEA I highly appreciate a couple of its features – so much that I don’t want to return to Eclipse, at least for this project, which takes more than half of my work time (the other part is divided among Eclipse and Visual Studio for C#).

However, this is NOT an attempt to compare IDEA and Eclipse in any way. I’m not such an Eclipse expert to state that the features I describe below are not present in Eclipse; I just want to express my experiences with the IDEA, concentrating on features that I think are not present in Eclipse, or perhaps that I haven’t encountered therein. (I’m concentrating on them, because there is a lot of great features that both IDEs have in common. It’s of no use to describe such features here.)

So, here are the IDEA features I like the most.

1. Very convenient content assist

First of all, IDEA provides the content assist fully automatically, without the need to press any key (e.g. Ctrl+SPACE) to get it. I just start to type, and IDEA automatically – and very quickly – shows appropriate suggestions:

Besides that, IDEA uses “substring” matching by default, and that is very handy for me. Many times I do not remember the starting part of an identifier name, only something in it (like here: “extpro” meaning “setExtensionProperty” – or, more often, I think I remember the starting part but actually it is not so.

Recently I’ve learnt that Eclipse has a special “substring” code recommender too. However, by default it shows such recommendations after sixth press of Ctrl+SPACE, and an obvious way of setting it to be a default didn’t work for me (I use Kepler SR1 which, I know, is not the most current version).

There are many other situations when content assist pleases me very much. One of them is automatically filling-in the name of missing variable or method that is used but not yet declared. For example, in the method below the aspectClassName is such a variable. As I start typing “String “ (and pressing Ctrl+SPACE in this case; this can be avoided if I started to type “a” instead), IDEA shows me some proposal, aspectClassName being among them!

For methods it is the same:

(Note: Eclipse seems to offer missing variables but not the missing methods.)

…and there are more such situations, for which I consider IDEA’s content assist to be a very strong and effective tool.

2. Syntax highlighting

This is a very subjective matter, but personally I like very much the IDEA syntax highlighting, particularly the relatively new Darcula theme. Eclipse does its job of highlighting also quite well, but I’m missing e.g. automatic graying out of methods, which are declared but not used, e.g. method3() in the following example:


3. Overall – good responsiveness

IDEA (once started) is really quick in response to my actions, even for large projects, as midPoint certainly is. For example, content assist items are shown almost instantly. In Eclipse versions I used to develop midPoint with (3.x at that time) it sometimes took ages. Now it seems to be quicker, but I consider it to be still slower than in IDEA.

And this is quite important for me, as it allows me to code really quickly.

4. No “save” nor “refresh”

This is a feature of IDEA that took me a while to get accustomed to. IDEA directly writes everything to the disk, so there is no “save” function.  And the same is for “refresh” – everything that changes on the disk is almost instantly shown in the IDE. Once I adapted to that, it started to save me time and mental energy while coding.

5. Well done integration with external tools I use

Among external tools I use, three are important for me: git for managing our sources, maven for building them and tomcat for running the code. All of them are nicely integrated with IDEA – I do not need to use any external tools to work with them. And their setup is very easy, basically only clicking “I want it” while setting up IDEA.

6. Custom content folding

Back to the GUI: In IDEA, it is possible to mark a block of code using //region and //endregion comments, allowing then to easily orient myself in larger classes. After collapsing such code, I can see e.g. the following:

Now if I want to see e.g. “auditing and notifications” part, I simply expand it.

Of course, code folding is a common IDE feature, however, only IDE A (and Visual Studio) has the possibility to specify custom borders for code folding – leading me, by the way, to tidy up my code into well-arranged parts. (Actually, I prefer to write smaller classes, which do not need this feature – but if I need to write a large and complex class, this saves me a lot of time when I want to navigate through it.)

Conclusion

What I’ve described above, is only a few of many useful features of IDEA that I’ve found are not present (or, at least, I think are not present) in Eclipse, as the other IDE I use. Certainly, IDEA has a lot more strong points, as well as some weaker ones. But generally, I clearly prefer to work with it on my major project, even that means I have to mentally switch between IDEA and Eclipse from time to time because of the other projects.

Leave a Reply

Your email address will not be published. Required fields are marked *