July 02nd 2010 | Jens C Brynildsen
IntelliJ IDEA is a cross platform editor that really sweeps the competitors off the floor. Do you want a better workflow, snappy editor, refactoring that really works, solid code generation and fast intellisense? How about UML support? Flashmagazine takes a close look at the Java based editor that now offers Actionscript and Flex support.
What is it? Java IDE with very solid Actionscript support
Platforms: Windows, Mac & Linux
Cost: free - €528
Are you tired of having to do the 'clean project/building workspace'-routine? How about an Actionscript editor that has refactoring and code hinting that doesn't break when your project reaches a certain (small) size? What about an editor that is capable of not looking trough every file in linked SVN repositories just because you saved a file? Then IntelliJ is for you.
I'm thoroughly impressed by IntelliJ IDEA, so much in fact that it's my new code editor replacing the Flash Builder/FDT combo I've been using up until now. Most often, Flashmagazine will be offered software licenses for free to do a review. With IntelliJ, I used the trial for 30 days and that was more than enough to convince me to buy it. That's right - I'm reviewing a software I bought and paid for that nobody asked me to review. That's rare.
Lets start with the basics. Downloading and installing is very smooth. The setup is simple but feature rich and the project setup requires minimal skills. As opposed to some other IDE's I've used, IDEA can use any SDK installed on your machine and it handles all the setup smoothly for you. Adding new Flex SDK's are also easy. You just download from adobe.com, unzip to a folder and browse to it using IDEA. That's it.
IDEA will always create a sample "Hello World" project for you that compiles with no changes. You can name this what you want and the only thing I've found annoying is that I can be a little too fast so I forget to check the "Actionscript project only" checkbox. If I forget this, I'll just delete the folder and make a new project. The entire setup and getting started has been totally smooth with a couple exceptions that I'll come back to later.
The program is organized as panels that you open or collapse to the borders of the program. Clicking any of the buttons around this border will open that panel. The panels can be collapsed, docked and undocked easily and it takes very little time to go from an overview like this:
to a zoomed in debug session like this:
To zoom the text size, just hold down CMD + scroll the mouse.
What I instantly loved was how much IDEA knows about your code. The code highlighting are simply brilliant. The IDE always knows if you have unused variables or imports. These are highlighted as grey and the second you use them, they change to the right color. Any non-existing methods are shown in red, so if you are writing a handler that you have not yet created you'll see this right away. To create the missing variable or method, just hold down the ALT-key and press Enter. This brings up a menu that will create the missing method with all required parameters. It's simply beautiful and while a few other editors have this, IDEA is just amazingly better at this.
As an example of how it's better - when you rename a variable, all instances of that variable will change - while you type it in. There's no dialogue, it just happens in your entire project as you type! As with other editors, you can just right click any class to open it at that very method. As with FDT, if you click a property that is Flash Player native, you'll see a stub class with all parameters, rather than that stupid dialogue that tells you it's a Flash Player internal class. Top that with the fact that the undo function even remembers you changes even if you close a file! There are simply so many neat features in this editor that I catch myself smiling every time I discover one of these features.
Another thing is the speed. The IDE is snappy and if you're used to Eclipse based IDE's you'll love this. It's not as fast as FlashDevelop on a good PC but this is the fastest Java based IDE I've ever used. Being based on Java, it can also run on any platform be it Windows, OSX or Linux so you're more free to swap platform using this IDE.
Intellisense and Code completion is excellent. When you import an API, IDEA will inspect it to build an index so you are not limited in any way. Hitting CTRL + Space will complete the current half-written statement (if possible). If not possible, a dropdown list of options are shown with the most likely ones at the top. CMD + O opens up a tree with all the methods valid for your class, based on inheritance and CTRL + N will open a menu for generating getters, setters and more.
Selecting any method from an inherited class will write a complete override method for you. You can also implement missing methods from interfaces using CMD + I. Interfaces have never been this easy to handle.
I also love that you can select any block of code, press a shortcut and quickly add conditionals such as if/else, try/catch, do/while, for and more around that block. This extends to many things so if you want an if around a line of code - once you've written the if-statement - IDEA will indent the line of code below and close the bracket for you. I have not tried this myself but adding new code templates is easy.
One thing that have always annoyed me with Flex/Flash Builder is that you are forced into organizing your files according to workspaces. Switching between these is time consuming and it really does not provide much extra to someone that already knows how to organize their files. Also - with the Adobe tools, you can only have one instance of the IDE running at once. With IntelliJ, you can have any number of instances running so you don't need to switch projects and workspace just to show a colleague another project or inspect something. You can put your project files where you want and clicking the .ipr project file will open the project in the IDE. As with Eclipse based IDEs, can't right click an .as file and edit it straight away but this is heaps better in terms of OS integration.
The windowing system is a bit odd, but I expect this having to do more with software patents than a will to implement. I've added a couple feature requests as I've tested and both bug reporting and requests are handled in a snappy and professional manner. I don't know anything about the size of JetBrains - the makers of the software - but they seem lean enough to implement required changes quickly.
Code inspection can be triggered and set to run as a background task while you're coding. This will produce a solid list of possible issues regarding assignments, code flow, possible bugs, missing statements and much more. The list even includes a spellchecker, so you can check if your code is readable to others and catch obvious spelling mistakes. I especially love that fact that if you forget to use camel-case, it will highlight this using a standard red dotted line beneath the word. It's all done discretely so spelling mistakes won't annoy you while you code or browse a codebase and you can configure if you want this to show more clearly.
There are so many unique features in this IDE that I really don't know where to start. Let me start by saying they're all quite unintrusive. The IDE never annoys me and that's never been the case with other IDE's. If/Else statements can be quickly switched. If code can be optimized or the IDE knows how to do things better, you'll see a small lightbulb (an IDEA!) that you can click to view the suggestion. When you delete a class, you'll be offered to do a safe delete that checks you project for the use of it. Want to know what parts of your codebase are dependent on a class? Right click anywhere in the class to to select Dependencies (forward, backward or even cyclic references). By pressing Alt + F7 you can quickly find all usages of a class, method or variable. The Analyze menu also allows you to look for duplicated code to help you during refactoring and as mentioned, the Inspect function is invaluable. I should add that these tasks can all run in the background while you keep coding. Oh - and if you don't run it as a background task and it's visible for more than 2 seconds, it will show you tips and tricks so you can watch that rather than the progress bar. Not important, but a nice touch and IDEA is full of these.
Some features you find in the menus won't necessarily work for Actionscript and the reason is that IDEA was written as a Java editor so some features are not applicable for our line of work (such as analyzing dataflow). These could well be removed while working on an Actionscript project, but they're kind of good to see that they exist as well.
Another sweet feature is ftp/sftp support built into the IDE. How often don't you test something and have to switch back and forth between the IDE and the ftp software? This really takes the pain out of it and if you use Code Versioning you have all you need installed. CVS, Subversion, Git and Microsofts TFS works right out of the box. ClearCase, Perforce, StarTeam and Visual SourceSafe are available. No more installing Eclipse extensions of varying quality - this just works. If you work in a Java environment, you'll also appreciate the Ant and Maven integration that require no extra install.
Another lovely feature is the UML generation. Right click any class to build a full UML diagram of it. This is just perfect for checking out new APIs, though I would love to see a way to easily hide the native Flash Player classes. It works well enough to be really useful though.
IDEA has a simple, but very effective debugger. As in any other IDE it triggers when something goes wrong or you asked it to stop using a breakpoint. The Debugger is snappy as it does not inspect the entire file. It just stops the SWF and then inspects any objects as you browse them. The trace outputs go to the console as you expect but I'm missing having a proper Profiler. Hopefully this will be added in a future release.
Other IDE's have basic refactoring such as renaming classes and variables or moving a class in the package structure. As mentioned before, IDEA can do this (better) but it can also do more. You can inline variables, extract methods, copy files to a new file with class names and packages updated and you can even move methods up and down in the inheritance tree.
As with any IDE, there is some getting used to. I didn't find it very hard to switch, though it takes a little time until the keyboard shortcuts are in the fingers. I downloaded and printed the Keymap until I felt that I didn't need it any more and I am surprised at the coding speed I now achieve. IDEA really helps in that regard and going back to any other IDE is a pain now. One thing that i found very odd is the lack of support for CTRL + W to close windows. IDEA uses CTRL + F4 and that took some time to get used to. I could of course have set it up in preferences, but I prefer to not use custom key mapping.
There's other UI things as well. By default, you can click and type anywhere on a line, so clicking beyond the end of a line will leave the caret exactly there. This can be convenient at times, but also confusing. I initially turned this off, but it's actually quite convenient when you want to add a comment somewhere after the end of a line. It's just different and I would expect it comes from command line tools that'll let you do this.
There are a few things that had me stumped while testing. One thing is that JetBrains are consistently using the name Flex over Actionscript? I kind of understand this from a Java developers perspective, but I find it a little odd as Flex is just a framework that runs on top of the Actionscript language.
Another thing is that you can't re-organize the main tabs as in Eclipse or any modern browser. It's not all that important, but it's convenient at times. (see Scully's comment)
Another issue I got was one that many may stumble upon. Upon every export, I got a dialogue that said that the debugger was already in use. This was caused by me having a non-debug version of the standalone Flash Player installed as my system default. Easily fixed, but not obvious unless you know. Another annoyance is that if a file is already running, IDEA can't stop it automatically. I rarely need to test multiple SWFs at a time so can I please have a checkbox that says "Always disconnect from running the compiler process" so I don't have to tick "Terminate the process after disconnect"?
When creating a project, you first specify a Flash Player version to target. When you set up the HTML wrapper, this choice is not retained so you have to change the defaults. All of these should be easy to fix and I've logged some of them in the official bug-tracker. They're also not show-stoppers in any way.
IDEA projects are set up using the Project Structure dialogue. Here you'll find Modules - a concept that will be new to Flash devs since it is taken from Java. When you link in external APIs, it seems logical that you add them under the Libraries setting. If you do so, the intellisense will work, but compilation will fail. Next obvious step for me was to look under Modules -> Dependencies and add my library here (SWCs go here). That didn't work either and it turns out you have to do this using the Module setup. It took me way too long to figure out that the text that says "Add Content Root" is actually a button. Clicking this will let you add any APIs required at compilation time. After adding this, you click the root source folder of the linked API and click the Sources button. Not hard when you know how to do it, but in no way obvious.
If you run into trouble with Error #1014 and java.lang.IndexOutOfBoundsException's when using embedded assets, just set the additional compiler flag -static-link-runtime-shared-libraries under your Module Settings - > Modules -> Flex Compiler Settings.
IntelliJ Idea comes in two versions - the Community Edition and the Ultimate Edition. The Community Edition is Open Source and free, but lacks some of the more advanced features such as UML and application server support. It also only supports a limited number frameworks, version control systems and languages. Some of these can be added via free plugins but not all.
Commercial licenses start at €220 / $249 but you can get a site license for a little more than the double. There's also academic versions available (€88 / $99) and trainers/teachers can get a free license by applying for it. You can also download a 30 day trial to check out the full product.
JetBrains, the company behind IntelliJ Idea realize the fact that those involved in Open Source projects often lead the way for other developers. Anyone involved in Open Source projects, can apply to get an Open Source Project License for the Ultimate Edition.
As with all new tools, there is some getting used to and changing your main development tool can be really hard. IntelliJ Idea is no exception, but I have to say that it seldom feels more rewarding than this. As opposed to Eclipse based IDE's, this feels snappy and the tool does not get in your way while working. Help is available, but the only thing you really need to learn is the keyboard shortcuts. All the functions you want are available using the keyboard, reducing the need to use a mouse all the time.
IntelliJ Idea is also very extendable and the selection of plugins is solid with more than 600 registered plugins. There's plugins to improve the editor, build tools, obfuscation, working with databases and even less useful but fun stuff such as Tetris and Last.fm. More important, there's plugins for languages like Scala, Lua, C/C++, Python, Ruby and others.
I'm really impressed by the completeness of IntelliJ Idea and how much it "knows" about my code. It's really not anything that I'm missing here other than the profiler. It's not often I review software that I become so impressed with that I start using it for my daily work. Switching workflows is hard and this is especially true for programmers when it comes to their code editor. There's so many things that I like here - big and small - such as the feedback form that pops up after using the software a few days, asking you for feedback and if they can help you in any way.
Jens has been working with Flash since version 3 came out. Since then, he's been an active member of the Flash community. He's created more than a hundred Flash games (thus the name of his blog) but he also creates web/standalone applications, does workshops and other consulting. He loves playing with new technology and he is convinced that the moment you stop learning you die (creatively speaking). Jens is also the Editor of this website.