I’m up to reason seven in the “Ten Reasons to Use Eclipse” posted by Renaud Waldura (my discussion of the previous six reasons can be found here: 1, 2, 3, 4, 5, and 6). I have to admit that this is one of my favourite reasons.
One aspect of Eclipse I dearly love is the utter lack of a “Build” or “Compile” button. Isn’t it paradoxical, an IDE that doesn’t let you build? IDEs started precisely as GUI wrappers around a compiler and a make tool, how can the “Build” feature be absent?
Here’s the key: Eclipse always builds for you. Every time you save a file, run a program or a tool, or any other action that accesses resources contained in the project, Eclipse compiles. This essentially means your code is always compiled. (Note that a “Rebuild” menu option is still present for those rare cases that require a manual build.)
I find this to have a profound impact on my programming work. For the first time I’m working in an environment where the natural state of code is compiled. Text, source code, used to be the primary form of a computer program. In Eclipse, source code has almost become a transient state, used only as input to the compiler. As soon as possible, and in fact, almost continuously, code is compiled to its binary form, with all the benefits of compilation (type checking, static analysis, etc.). Eclipse also builds incrementally, thus ensuring that most build operations are completed within seconds.
I couldn’t agree more. Incremental compilation rocks. However, it does tend to catch people off guard. On a fairly regular basis, we get questions about compiling Java in Eclipse (generally on the newcomer newsgroup, or on EclipseZone). Most folks assume that there is a big “Build” or “Compile” button hidden somewhere but can’t find it. It’s initially hard for some folks to get their brain around the fact that compilation of Java code just happens (usually Eric or Ed will set them straight).
Incremental compliation ensures that your application code is always ready to run. As Renaud points out, Eclipse keeps track of the dependencies amongst all the files and rebuilds only those components that need to be rebuilt. Compilation happens in the background, so unless you’re paying attention, you’ll likely not even know it’s happening.
As an aside, something that a lot of people don’t know about the Eclipse Java compiler is that it was designed to be decoupled from the Eclipse platform. The JDT can be used separate from the Eclipse platform; even from the command-line. If you’re using Apache Tomcat to host Java ServerPages (JSPs), then you’re using the JDT. When you’re using the JDT batch compiler, you don’t get the fancy incremental compilation, but you do get a darned fast, top-quality Java compiler that you can easily make a part of your Ant build scripts.
I love the Java compiler in Eclipse. Of course the notion of incremental compilation isn’t anything new. We’ve had incremental compilers for years. I am duty bound to point out that incremental compilation was a fundamental part of Smalltalk. VisualAge for Java also employed incremental compilation. It is natural, then, that the JDT developers would make it a fundamental part of their implementation.
Them JDT guys are some smart.