Enjoying Java and Being More Productive with IntelliJ IDEA
Every time I visit a Java conference or a meetup and talk to people unfamiliar with IntelliJ IDEA, I get similar questions again and again: “What’s so special about IntelliJ IDEA? What does IntelliJ IDEA has that other Java IDEs don’t?” In response I usually simply demo a few of its features and then just watch their jaws dropping.
But you know, repeating this over and over is a bit counter-productive, so I’ve written this guide to sum up everything you need to know why IntelliJ IDEA is hailed as the most intelligent and user friendly Java IDE, which can and will make you a more productive developer.
Deep insight into your code
When you’re writing code, IntelliJ IDEA is busy with building its syntax tree, creating references between classes, variables, fields, methods, and their usages, analyzing the execution flow, and lots of other things. Using this information, it can provide completion, help you quickly navigate thru your code, and, of course, provide error analysis and offer handy quick fixes.
When you open a project for the first time, it takes a while to build these indexes, but after it’s done, IntelliJ IDEA offers blazing fast and intelligent experience by automating all the routine tasks and letting you focus on the creative part of your work.
Any of the modern IDEs will give you a more or less similar feature set: code completion, refactorings, and navigation, but only IntelliJ IDEA leverages the power of deep static code analysis at its most to make coding assistance way more intelligent and efficient.
Everyone knows that completion is a number one feature for any IDE. IntelliJ IDEA brings you several completion types that are really something, because they are based on the deep code intelligence mentioned earlier, and therefore are able to save you a lot of time (and typing.)
Call it via Ctrl+Shift+Space (Cmd+Shift+Space for OSX), to get a list of suggestions of classes, variables, fields and methods already filtered by the type compatible with the current context.
Static members completion
If you don’t remember class name with a static method or a constant, just start typing that constant name and call code completion twice. IntelliJ IDEA will give you a list of classes containing members with the name you’re looking for, and when you choose to use one of the variants, it will automatically add required import statements.
Imagine symbols in current context do not have a value of compatible type, but some of their children do. Invoking Smart Completion twice in a row will give you a list of these choices, saving you the time that would otherwise be spent looking for a suitable expression.
Data flow analysis
When offering completion variants, IntelliJ IDEA also analyses possible data flow to guess the possible runtime symbol type and provides choices based on it, automatically adding class casts.
IntelliJ IDEA can automatically add required parentheses, brackets, braces, delimiters and apply necessary code formatting. To see how it works, try typing “if” and pressing Ctrl+Shift+Enter (Cmd+Shift+Enter for OS X).
In IntelliJ IDEA you often even don’t need to call completion explicitly. When you start typing any character, it will instantly start suggesting the most relevant options.
If you define a datasource in IntelliJ IDEA, you will get code completion for SQL expressions, based on its actual table schemes.
The nice side-effect of having the code syntax trees and their relationships indexed is that it makes IntelliJ IDEA able to manipulate these trees to apply complicated refactorings across many languages, expressions, and dialects.
For example, when you call Rename refactoring on a class within a JPA statement, IntelliJ IDEA recognizes that you need to rename a JPA entity class, and applies changes to the class and every JPA or other expression in the project—in a matter of seconds.
IntelliJ IDEA knows your code so well it can detect duplicate blocks on the fly.
If you extract a variable, constant, or method, the IDE will check if there are other similar code within the scope that could be replaced with the new variable, constant, or method as well.
Smart extract of String literals
If you select a fragment of a String literal and call one of the Extract refactorings, IntelliJ IDEA will create a constant and replace its usages across the code with references to it.
In the most cases, you don’t even have to bother selecting the statement you want to refactor (e.g. extract, move, rename or inline): IntelliJ IDEA will guess the statement automatically or will offer you to choose from a list of available variants.
IntelliJ IDEA can easily rollback even the most complicated refactorings–with just one click. So it’s perfectly safe to experiment with the code in any way you like.
Every aspect of IntelliJ IDEA, its features, functions, UI layout, and integrations were all specifically designed to maximize developer ergonomics. IntelliJ IDEA is built around the idea that every minute a developer spends in the flow is a good minute, and things that break developers out of flow are bad things.
Every design and implementation decision considers the possibility of interrupting developer’s flow and seeks to eliminate or minimize it.
A good example of IntelliJ IDEA flow friendly design is when you reference any class, static method or a constant, IntelliJ IDEA takes care of the import statement up there at the head of the file while you keep coding away where you are.
If it sees that you have just done something that’s a potential problem, a little light-bulb pops up on a sideline. You can ignore it and just keep typing (which is quite often appropriate), or you can see what’s wrong by just pressing Alt+Enter.
Yet another good thing about IntelliJ IDEA is that most of your time the editor (and the code) is the only thing visible on your screen, and you don’t need to leave it to do something that isn’t coding-related, including generating code, switching between tool windows and project files, and even debugging.
The column running down the leftmost side of the code editor is called the “gutter” and provides useful information and quick access to actions that let you navigate through code, execute it, manage breakpoints, and do much more.
Having the inline debugger, the gutter and shortcuts for every action allows for layout where you have more screen space because auxiliary controls like toolbars and windows can be hidden.
You can always maximize the editor by pressing Ctrl+Shift+F12 (Cmd+Shift+F12 for OS X). To restore the layout, press the same shortcut again.
Accessing a tool window via its shortcut moves the input focus to it, so you can use all keyboard commands in its context. When you need to go back to the editor, just hit Esc.
No save button
The most controversial, yet one of the greatest features of IntelliJ IDEA is that it saves all changes automatically, so you never need to worry about losing any of it. If you decide to rollback anything, you can always do it by using Local History. Even if you apply a complex refactoring that affects many files, you can quickly Undo it with one click.
Like everything else in IntelliJ IDEA, actions are designed for better ergonomics too. The first call is supposed to provide most expected results. Need more results? Press the shortcut again and the IDE will go deeper to find what you need.
Actions that recognize this behavior include Basic Completion, Smart Code Completion, Navigate To Class, Navigate to File, Navigate to Symbol, Structure popup and some others.
In IntelliJ IDEA you don’t have to walk through complex wizards or fill huge forms to get things done.
When you’re in the Project tool window, you can not only navigate through the existing items, but also create new ones by just pressing Alt+Ins (Cmd+N for OS X).
New users usually think that Navigation Bar is just a breadcrumb, but more experienced developers know that there’s a lot more to it. After you jump to it via Alt+Home (Alt+Up for OS X), you can use it to navigate over the entire project structure; create and change files, preview their content, and do many other useful things.
IntelliJ IDEA has no perspectives like other IDEs (e.g. Eclipse) do. You don’t need to switch between different layouts to do different tasks. IntelliJ IDEA follows your context and brings up the corresponding tools automatically. Added benefit is that since there are no perspectives, all the shortcuts and actions stay the same all the time.
All lists, trees and popups in IntelliJ IDEA provide you with quick search that instantly takes you to a set of items that contain text you’re typing in them.
Built-in developer tools
Terminal, Coverage, VCS, Decompiler, Bytecode viewer, Database, FTP, Application servers
Top frameworks are supported out of the box
Java EE, Spring, Android, GWT, Vaadin, Play, Grails, Hibernate, Thymeleaf, AngularJS, React, Velocity, Freemarker, Struts, Guice, JavaFX, Swing
Windows, Mac OS X, Linux
When you work with IntelliJ IDEA, usually you don’t need any plugins, because the most useful functionality is available out of the box. Yet, IntelliJ IDEA has a rich plugin ecosystem and mature plugin developer API.
Free and commercial editions
For pure Java, Groovy, Scala, Kotlin and Android development–there is a free and open source IntelliJ IDEA Community Edition. For web and enterprise development, we offer commercial IntelliJ IDEA Ultimate (30 days of free trial and more if needed). If your company needs a group trial for longer period, contact us and we’ll provide it shortly.
Something is broken or you have a feature request? Submit an issue to our tracker, and we’ll do our best to get the problem fixed as soon as possible. For customers (and in fact for regular users too) we have a support channel where we help with questions and other important problems.
How easy is it to migrate from another IDE?
It’s difficult and may take some time (for some a week, for others a month or longer). Be sure when done, it will pay off with everyday productivity boost and enjoying your work. For migration from Eclipse, read this guide.
Good or bad but there is no better way to learn IDEA than by downloading it and actively trying it. If you work in situations where time is most definitely money, and sustained productivity is the measure of success, you can do worse than to take a good look at IntelliJ IDEA.
- PostIntelliJ by Martin Fowler
- Refactoring in IntelliJ IDEA, Live by Robert C. Martin
- Why we Dropped Eclipse in Favour of IntelliJ by Nikita Salnikov-Tarnovski
- 42 IntelliJ Tips and Tricks by Hadi Hariri
- What Makes IntelliJ IDEA Different by Andrey Cheptsov
- Top 20 Features of Code Completion in IntelliJ IDEA by Andrey Cheptsov
- Top 20 Refactoring Features in IntelliJ IDEA by Andrey Cheptsov
- Top 20 Navigation Features in IntelliJ IDEA by Andrey Cheptsov
- IntelliJ IDEA Refcard (PDF) by Andrey Cheptsov and DZone
- Migration Guide for Eclipse Users by Andrey Cheptsov
- IntelliJ IDEA Pro Tips by Andrey Cheptsov
Develop with pleasure!