Sunday, March 26, 2006

25 Reasons I Love Using IntelliJ Idea

I just republish this article from unknown author here. Here is originally link: http://members.iinet.net.au/~gstamp/IDEA.html

IntelliJ IDEA is a relatively new Java IDE. It's the most useful Java development environment I've used (and I've used most of them). It’s highly optimized to make common tasks blindingly easy.

Often it's not the big ticket features that really make a product usable. It's the small touches: the many little details that go into making the overall package seamless and a joy to use.

What follows is a list of things I really love about IDEA.

1. Syntax sensitive word selection.

Pressing Ctrl-W repeatedly incrementally selects larger expressions up until the point at which the whole file is selected. While this doesn’t sound like much of a big deal this works really well in combination with other features such as the “introduce variable” refactoring. I can position the caret over complex expression, press Ctrl-W until the section has the desired scope and press Ctrl-Alt-V to introduce a new variable for that expression. IDEA will even automatically replace other occurrences of that expression if I want.

2. Multiple forms of navigation.

IDEA has a ton of ways of getting around in a project. All of which can be performed with the keyboard in addition to the mouse (which is great for people like me who can’t stand swapping to the mouse constantly). Ctrl-N will let you quickly find a class by incrementally typing in its name. Ctrl-Shift-N will do the same thing for files. Ctrl-E will bring up recently edited files then let you start typing the filename or arrow to the desired file. The commander lets you easily navigate two views of your project and makes certain refactoring operations a breeze. Alt-F1 allows you to select the current file in any of the other views. The list of ways to get around your project is too huge to list them all here. All this and no need to have concepts such as perspectives.

3. Local history.

With local history turned on every change you make to your source (within the tool and externally) is tracked. This feature has saved me more times then I care to admit. The differences are highlighted in a really beautiful looking difference viewer.

4. Flexible JUnit support.

Unit tests can be run individually. Particular test methods can be singled out to run individually. IDEA can automatically run all tests in a package or in the project without the need to setup a pesky test suite manually. Double clicking on the stack-trace in the GUI runner will take you straight to the line in the source code. Personally I prefer the text runner. It's not as pretty but it's faster and more functional.

5. Well designed refactoring support.

IDEA supports a large number of refactorings. More importantly they're well designed and easy to use. Some you’ll use all the time, other’s you may only use rarely. When you do find you need them they can be a big timesaver.

6. Code assistants.

There are some truly powerful code writing assistants in IDEA. I can only really give you a small taste here. A good example is the "Delegate Methods" assistant. This allows you to delegate method calls (which ones is up to you) to an object instance in your class. This is not something you require every day but when you do need it you'll find yourself saving a huge amount of time. Another example is the generate hashcode and equals feature. This is one feature that you will find yourself using very frequently. Other great code assist features are: generate getters/setters, generate contructors and the “surround with…” features.

7. Flexible code reformatting.

There are a stack of options regarding how code can be reformatted. This can be set individually for each project so there's no need to worry if you have to support multiple code standards. Reformatting a file or an entire project is a snap.

8. Great XML support.

IDEA supports code completion inside XML. If no schema or DTD has been defined IDEA will complete based on what's already contained in the file. Otherwise it’s possible complete based on the defined schema or DTD for a file. IDEA will also validate the XML on the fly.

9. Intuitive and easy to use GUI.

Pretty much every function within the program can is accessible using the keyboard. This is how it should be in a developer’s tool but sadly most IDE’s pay very little attention to keyboard navigation.

There's no need to swap between different views to get your work done and there's no need to tab between different windows.

10. Automatic synchronization with the file system.

No matter how good your IDE there will usually come a time when you need to do some work outside of the tool. IDEA does this very well. Most projects can be used inside IDEA without having to make changes to their structure. IDEA also checks for modifications to files that may have been made externally. There's no need to manually refresh to tell IDEA a file has changed.

11. Customizable Keyboard Mapping.

The default keyboard map that comes with IDEA is useful as is but sometimes it's useful to modify it. This is easily done. Keys can also be assigned against things such as external tools and ant targets.

12. Dynamic error highlighting.

Java code, XML and JavaDoc tags are dynamically analyzed and any errors reported as you type. Ant build files even have extra support for the Ant project syntax.

13. Inspections.

Code inspections can be run that report a large number of potential trouble spots with the code. This can be scripted to run as a batch job and the results reported to a webpage.

14. Complete understanding of JSP.

IDEA understands the structure of JSP’s so many of the functions that work in normal Java code also work in JSP's. (Refactoring for example). JSP debugging is also supported.

15. Smart editing.

Little touches such as typing past quotes and brackets make life that much easier.

16. EJB support.

IDEA understands EJB's although it does not include specific support for particular application servers. This is best done with the Ant integration anyway. The EJB support is easy to use and unobtrusive - just as it should be.

17. Almost no wizards!

Many vendors these days bundle a ton of wizards rather simply designing an easy to use interface. Wizards have their place but are a grossly overused tool. IDEA only contains a single wizard to help create a new project and has still managed to create a program that is easy to use for the novice.

18. Smart templates.

Smart templates are snippits of code that have been supercharged to do all sorts of amazing things. The first time I used the “iterate over collection” smart template I was astounded. Not only did it pick up the correct default collection variable but it also noticed what I had been putting into it and defaulted the casting. This feature is rather hard to describe on paper. Download an evaluation and try it out.

19. Best support for code completion.

IDEA has three types of code completion available including support for completing default variable names, javadoc and other code items.

20. Ant integration

IDEA has support for the Ant build tool. In addition to running targets there is support for running targets before and after compiling and running programs as well as support for binding keyboard shortcuts.
When editing an Ant build.xml file, IDEA also provides extra support for completing the XML elements that make up the Ant project.

21. Unused code highlighting.

If IDEA can detect that a particular variable or method is unused it will report is unobtrusively as a warning. Inspections can be used to do more detailed dead code analysis. Even JavaDoc tags are checked.

22. Little extras.

Ctrl-D duplicates the selected code. If there is no selection it will duplicate the entire line. Ctrl-C will copy a whole line when no selection is made, Ctrl-X will cut the whole line when there's no selection.
Ctrl-Shift-J will do a VI-like join except that it's syntax sensitive. For example if you have a line like:

String s = "This is " +

" a split string";

And join it you get:

String s = "This is a split string";

To top it off if you press enter inside a string it will automatically add the quotes and + operator.

23. Regular expression search and replace.

Regular expressions searches are possible but even nicer is the fact that you can do regular expression replaces. This can be a big time saver.

24. Quick JavaDoc.

JavaDoc for any identifier can be easily viewed by pressing Ctrl-Q. It can also be accessed during code completion.

25. Intention actions.

Many helpful options are provided when IDEA notices it can help you in some way. For instance if you need to cast an expression so that it matches the variable you're assigning to IDEA will notice this and give you some options for either casting it or changing the type of the variable you're using.

2 comments:

Anonymous said...

Re point (1): Introduce Variable. Using IDEA without SmartIntroduce feels like using notepad again.

t800t8 said...

The different thing is Notepad doesn't introduce anything ;-)