Sonntag, 21. Oktober 2012

Why I like Eclipse and sometimes not

I learned from the comedy movie Borat that a typical way to turn a statement into a humorous one is to append "not" at the end of it. So I did this as well in the title of this article. Admittedly, the main reason being though, that no one would otherwise read an article titled "Why I like Eclipse" ... ;-).

I often happen to meet people in projects that are really into NetBeans or IntelliJ IDEA and not into Eclipse at all. These people don't understand why someone like me would work with Eclipse (I also use IntelliJ IDEA quite a bit). The problem is here that explaining why I like Eclipse results in a long talk which is first about Eclipse background knowledge that demands a lot of patience and distracts people for too long time from their work. Secondly, a long talk is followed about why I feel very productive when good code browsers as in Eclipse are at my disposal. So I'm trying to explain it in this little article once and for all for the benefit of the world (eventually, you need to append again "not" at this place). Don't worry, it's not going to be one-sidedly as I will also talk about the things in Eclipse that are not that amusing. It's merely about code browsers and their differences than specifically about Eclipse.

Code Browsing

The real reason I like Eclipse is its powerful code navigation and code browsing capability only comparable to the code browsing its big idol which is the excellent Smalltalk environment. I'm willing to sacrifice a lot of other things as long as I have that. Let me quote Bertrand Meyer: “Smalltalk is not only a language but a programming environment, covering many of the aspects traditionally addressed by the hardware and the operating system. This environment is Smalltalk’s most famous contribution”. [1] This statement includes that Smalltalk not only is a language with an IDE on top, but a computing environment as such. This coherence has gone lost with Eclipse which has good and bad consequences. But this is a different topic, too long to talk about it here as well. The people that have worked with Smalltalk understand what this means. But the people that have not, only gaze fixedly at you for a moment and then continue working. So my contribution in this article is aimed at explaining what this is about. Earlier, people often have heard about Smalltalk and are willing to listen for a while. Nowadays, you have to say something like "Smalltalk is the system that had closures from the beginning already in 1980 from which later this clone was made starting with a 'J'". Otherwise people would not even stop coding for a second. Or you have to say something like "Smalltalk is the system Steve Jobs was looking at when visiting Xerox Parc (see also this article about Xerox Parc) when he said that this is the way he wants the user interface to be on the computers he is producing" (user interface with icons, moveable windows that can be collapsed, and a mouse).

What's the catch about excellent code browsing capability then? Problem is that when your code starts to grow, you somewhen reach a point where it is hard to keep oversight. Well, that is was structured programming is for: you can structure your code and then there is abstraction, information hiding, modularity, inheritance, polymorphism and more. But somewhen you can't remember any more in which class what method was placed and it is sometimes still hard to keep oversight even with abstraction and all that. I have seen people that are nevertheless able to understand their code very well using simple development tools only. Therefore, I agree that you don't necessarily need to have an IDE with good code browsers. For some people it's a necessity. For others it's a matter about comfort and maybe also developer productivity.

Eclipse’s heritage from the Smalltalk IDE

Eclipse was developed by the people of a company named OTI in Ottawa, Canada, that used to develop and market the other big Smalltalk development system at that time in the market (besides ParcPlace Smalltalk, now Cincom Smalltalk) which was first Envy/Developer and then OTI Smalltalk (I’m not sure about the name here). When the development of Eclipse started OTI was already acquired by IBM as IBM wanted to sell OTI’s Smalltalk system as IBM Smalltalk as a replacement for their failed CASE tool strategy. The product named IBM VisualAge for Smalltalk was also very successful (especially in the finance sector) at a time where there was only C++ and Smalltalk for serious production quality OO development. Later Java came along and IBM abandoned its Smalltalk system, sold it to Instantiations and jumped onto the Java train developing IBM VisualAge for Java. VisualAge for Java was very much like the Smalltalk IDE only the programming language being Java: It was an interactive development environment where almost any statement could be selected and executed at development time. You could look at your data in inspectors in which you also could send messages to objects dynamically at development time. From what I have heard VisualAge for Java itself was developed in IBM Smalltalk, but I cannot provide evidence for this. This was IMHO a very productive development environment and everything was fine as long as your application only consisted of the code you were writing. But then web development came along and this was no longer true as now, beside source code files, a plethora of all other kinds of file types came into play: html, jsp, xml, css, jar, war, ear, and much more and they all have to be bundled together. The latter was as much a problem for Smalltalk’s/VA Java’s approach to create a runtime package as the former. So VisualAge for Java was abandoned and Eclipse was developed. If you managed to get to this line, the bits of Eclipse history I had to provide are now behind you ;-).

Code Browsing in Eclipse

So far I have not mentioned why code browsing in Eclipse is so fantastic (let’s say it is better than in many other IDEs at least). There are different browsers for different things. If you are working on code files only you can use the "Java Browsing" perspective. You see the packages and their classes of your project at a glance and everything else is removed. You can still have the "Java" perspective  where your Java code and all the other types of files are visible at once. You can have all the browsers you work with side by side each in a window of its own. Select Window > Prefrences > General > Perspectives > Open a new perspective and select "In a new window". From now on every perspective you open will open in a new window of its own. Most people working with Eclipse I have seen don't know this feature at all. But this is the usual way the Smalltalk IDE was intended to be used. Then Eclipse has an equivalent for the Smalltalk class hierarchy browser. It is also not activated by default. To do so you have to go to Window > Prefrences > Java > When opening a type hierarchy and select "Open a new Type Hierarchy Perspective". I always found this browser to be very useful when working on an abstract class and some of its concrete subclasses, because you can really concentrate on just that what matters in that regard.

I once had a situation where Eclipse ran out of memory, which was probably caused by the memory demands of the OSGi implementation when building from within Eclipse. But because of me using several browsers at the same time in Eclipse as I used to do it earlier when developing with Smalltalk, some colleague was absolutely sure that having that many browsers open consumed too much memory. When I switch between perspectives that are displayed in the same window, memory remains allocated for all of them just the same way as when they are opened in their own window. No way you could switch between perspectives that quickly, otherwise. But that argument just didn't fly. Some people are that used to just working with a single window IDE that anything different appears simply weird to them.

And why I sometimes don’t like Eclipse

Eclipse provides a solid base to place an IDE on top of it for all kinds of things. Its Java plugin is also very useful. But it is not always as good at specific tasks such as code completion (IntelliJ IDEA is IMHO awesome here), refactoring (needless to say that "Refactoring was conceived in Smalltalk circles” [2]), “intra-file navigation” (jump from some JSF xhtml statement to the underlying Java code, etc.). It does not have an excellent Swing IDE builder such as NetBeans. When you develop a web application all the plugins that come into play are not nicely integrated and concerted as in IntelliJ IDEA. Also MyEclipse does not do much about this in the end. The weakness of Eclipse in short is that it stops after providing a plugin platform and a Java plugin. From then on every one is left to his own devices. A lot of nice people have developed very respectable plugins for all kinds of things, but they miss “calibration” with related plugins rendering them isolated solutions.

Then Eclipse has become sluggish and sometimes irresponsible. I’m not amused how often Eclipse is irresponsible and I have to wait till it’s responsive again. I don’t know exactly what the reason is in every case. Maybe just someones plugin is not well written and is causing this. Whatever, as already said, other IDEs don’t have this problem as all the plugins that come into play are inter-coordinated and tastefully furnished. 

Last but not least, at the time of writing (21st October 2012) Eclipse has still no support for JDK8 lambdas and default methods.This is because Eclipse’s Java compiler is built into Eclipse and cannot be easily separated (you can define a custom builder for your project which will call the javac of the JDK you defined. But the JDT will still not be able to deal with JDK8-style lambdas). So the whole thing has to be exchanged. This is probably some heritage from Smalltalk as well where the whole thing was a single system. Earlier at that time, this was unmatched coherence (compared to piping in a myriad of little Unix tools). Nowadays it's considered inflexible and monolithic. I use IntelliJ IDEA 12 EAP for my current little spare time JDK8 lambda project. So far there was never a problem to get any lambda expression compiled and to run. Simply amazing.

Last and least, I really wished NetBeans and IntelliJ IDEA had a class browser in addition like the one in Smalltalk or something like the “Java Browsing” perspective in Eclipse. When you are working on code only and no html, xml, css, or whatever files are part of your application, IMHO, there is nothing like it. But in todays world there is no way to develop an application without any xml (or json nowadays), for example. But I'm convinced there is a way to merge the best of Eclipse/NetBeans/IntelliJ IDEA with the best of the Smalltalk IDE.



1. Bertrand Meyer, Object-oriented Software Construction, Prentice Hall, 1988, p.439.

2. Martin Fowler, Kent Beck (Contributor), John Brant (Contributor), William Opdyke, don Roberts, Refactoring: Improving the Design of Existing Code, Addison-Wesley, 1999, p.6.