Blog sobre desenvolvimento de software (Java, muito Java!), inovação tecnológica e cotidiano do Universo de TI. Acesse notícias, tutoriais, material de cursos e eventos, código, desafios, soluções, opiniões, pensamentos, divagações, balbuciações e abobrinhas diversas. Deixe seu comentário!

terça-feira, 8 de outubro de 2013

Java IDES - One shortcut to rule them all

"Three IDES for the Java-kings under the sky,
Seven were once famous in their halls of stone,
Plenty of others for Mortal Men doomed to die,
One shortcut to the Productivity Lord on his dark throne
In the Land of Java where the Shadows lie.
One shortcut to rule them all, One shortcut to find them,
One setting to bring them all and in the darkness bind them
In the Land of Java where the Shadows lie."
- J. R. R. Tolkien, The Lord of the Rings (slightly hacked)

I've been a polyglot programmer and multi-IDE user for several years... And as any all-arounder, I am not the most productive expert on any of them. IDES are huge beasts! It takes time to learn and to allow all of its functionality to sink in and it takes even more time to learn how to do things efficiently. 

Memorizing highly specific keyboards shortcuts of each IDE is one of the many actives that can become tedious or even completely unachievable if you switch between IDES frequently. Still, all in all I do prefer this road, since every IDE has its unique qualities. I'm a huge believer of the motto "Use the right tool for the job." Quoting the amazing Abraham H. Maslow's Psychology of Science: "I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail." Please avoid temptation!

So let's check out how to cheat and increase productivity by learning "Tool tamer" shortcuts for the most popular IDES in Javaland.


The idea behind this article is that if you can learn how to find desired functionality in the sea of options that one IDE has to offer, then you can teach yourself to be more productive with it. If you can configure all of your IDES to use the same shortcut to access the desired functionality then congratulations, you have just created a shortcut to rule them all.

Eclipse


If you make a living out of Java, chances are that you have spent some time with Eclipse, either because you love it or because that's what everyone else in your company uses! Eclipse is the only IDE that an entire army of (not that enthusiastic) Java Developers have ever learned how to use: it often offers the only best third-party plugins for a certain software stack. Eclipse is the most popular IDE in Javaland. Developed by an impressive foundation - backed by a giant group of technology companies and fueled by a vibrant community - the extremely customizable SWT-based IDE conceived by IBM isn't going away anytime soon.

If you don't know how to do something in Eclipse, just resort to the handy Quick Access functionality (Ctrl+3) and type the desired action (say, "Extract Variable").


If you don't like Ctrl+3 just bind the Quick Access command to some other key combination. In order to do this follow these steps:
  1. Navigate to Windows Preferences
  2. In the right menu open General → Keys
  3. Locate and select Quick Access
  4. Change its binding to the desired key combination
  5. Click on Apply and OK
 


Netbeans


"The only IDE you need" was the Netbeans motto back when Sun shined. It is intriguing to observe how  a lot of my colleagues dismiss this very crafty IDE as "slow"... This might have been true once upon a time when Netbeans hadn't yet reached its fourth release, the VMs were not optimized for Swing Applications, and computers were shipped with way less memory and very poor graphic cards. Nowadays Netbeans is a very responsive IDE with amazing UI Design Tools (JavaFX anyone?), a great out-of the-box experience for Java SE and Java EE, out-of-the-box support for a variety of Java tools and frameworks, plus a surprisingly competent out-of-the-box support for other programming languages (such as PHP, Groovy and C/C++). Netbeans surely lives up to its motto, and does this with a clean, hassle-free philosophy which makes it the perfect IDE to use in classroom.

Much in the same fashion of Eclipse, Netbeans exposes a Quick Find command which can be triggered with Ctrl+l. Although unlike Eclipse, Netbeans tries to find a lot of things by default (Types, Symbols, Help references, Maven artifacts and so on). So if your goal is to find an IDE functionality it is advisable to narrow the search category (accessible with Shift+F10 when the cursor is on the search bar) to Action.


I have never really liked Ctrl+l as a shortcut to Quick Find. So Thanks Sun for shortcut customization. To change your keymap, do the following:
  1. Navigate to Tools Options
  2. Click twice on the Keymap button located at the top Toolbar
  3. Look for "Quick search"
  4. Click in the Shortcut cell (or on the small ellipsis button) to edit
  5. Type your new key combination
  6. Click on OK



IntelliJ IDEA


How does a company make money out of a Java IDE when programmers can just download very good IDES such as Eclipse and Netbeans for free? Easy, you make the best tool on the market! And that's exactly what JetBrains did with IntellliJ IDEA. But don't take my word for it: just read what Martin Fowler has to say about IntelliJ (in its way, Martin Fowler is the IT version of Tom Hanks, we can always borrow its credibility). While there is a free Community Edition (which is good enough to run the amazing Scala Plugin, light years ahead of the competition) the good stuff comes with a price tag.
Is it worth it? Sure! I think that IntelliJ is indeed the Best Java and Polyglot IDE there is. I feel that developing with IntelliJ is a pleasure. Yes, I think that it can read my mind. And yes, I'm sold. But no, I'm not on commission, although if someone at Jetbrains ever reads this article and feel like donating a lifetime IntelliJ license, I'm all for it)!

God is in the detail!  And IntelliJ Find Actions command has a very different (and, in my option, way better) approach for searching actions than Eclipse and Netbeans top right corner search boxes... Ctrl+Shift+a makes IntelliJ pop up a contextual menu right in the middle of your code. Easy, fast and to the point.


If Ctrl+Shift+a stresses your fingers (or your brain), no problem - here is the receipt to change it:
  1. Navigate to File → Settings
  2. At the left menu click on Keymap
  3. Look for "Find action"
  4. Click twice on it to customize the shortcuts
  5. Click on Apply and OK

And that's all: you've learned how to find your actions and teach yourself new shortcuts using three of the most popular Java IDES. Plus you have mastered how to customize key bindings according to your desires. Now come on, don't be a Hobbit (or eight Hobbits, also know as a Hobbyte)! Use the precious shortcut... Rule them all!

3 comentários:

Anthony Accioly disse...

This is my first blog post in english (so please excuse any typos). A big Thanks to mom (Monica do Coutto Monni) and Wayne Duquette for all of their help.

Helder da Rocha disse...

Good article! It would be interesting to know what you think of cloud IDEs. Have you tried Cloud9 IDE or CodeEnvy? It seems to me that cloud IDEs may become very popular in the future, specially for open-source projects. It would be nice to have a Cloud IDEA :)

Anthony Accioly disse...

Hello Helder. Thanks for the compliments. I am keeping an eye on cloud IDES (since the first days of Eclipse Orion). They are slowly but surely maturing and I am very impressed by what products such as Koding are already capable of doing. About a Cloud IntelliJ, it would be a dream! A certainly feasible dream :). We just need to mature the "tools to build the tool" a little bit. Widget toolkits (such as Ext JS); standards for modular and extensible client side components (such as AMD), productivity tools (such as Emmet), etc. There are a lot of building blocks that need to be put together if we want to have Web Based IDES anywhere as good as their Desktop counterparts. Desktop IDES are some of the most remarkable forces behind RCP and OSGi. I am confident that they will also push the boundaries on the browser! Someday we, the spoiled children of Java, will have tools beyond our imagination at our disposal.

Postar um comentário