Netbeans 5 Testdrive
Wednesday 26 October 2005 @ 5:08 pm
Filed under:

VIM LogoTen year ago my programming tool of choice was VI, the well known unix editor for mentally scattered and dazled software engineers. When making the jump from C/C++ to Java, Vi was still my tool. In combination with make scripts it had everything a programmer want. Yep, it had syntax colouring, auto-completion, yep it had javadoc lookup, and indeed using the right set of macro’s there were even wizard-alike ways to construct new classes and interfaces. Of course it was not the original Vi anymore, I was using the still available improved version of Vi.

Somehow something went wrong. And I do not know exactly why and when but around five years ago I found myself using a blown up ‘Integrated development environment’ instead of my favourite good old editor. When looking back it was like waking up in hell. Memory consumption and processor speed were disrupting my programming effort. The good old commandline was replaced by a repetitive strain injury causing device called mouse. And I liked it? Things got even worse. I started jumping from IDE to IDE. My first was Kawa (an ide nobody can remember anymore, not available anymore but found this year 2000 dated article about it that brings back nostalgic feelings). I did some things with JCreator, started using Netbeans and finally after two years of struggle ended using Eclipse. And Eclipse was good! Eclipse was God of IDE’s. Okay IntelliJ was better but Eclipse was free and the gap between the two wasn’t worth the money. Eclipse was the first IDE that never gave me arguments to sneakily still use my oh so beloved old fashioned but very powerful vi. And the reason for this can all be expressed in one word: refactoring!

NetBeans LogoRefactoring is re-arrenging your code all the time. Introduce new interfaces, move classes from package to package, promote methods to be part of a super class, delete classes, change method signatures and so on. It’s a way of programming, once adopted, can’t be left anymore. And eclipse was the only free tool supporting this way of engineering. Untill this autumn. Untill Netbeans released the beta version of their new 5.0 IDE. And the new netbeans has all those nifty refactor options inside. So I decided to give it a testdrive.

NetBeans LogoUsing both netbeans and eclipse I’ve been doing some simple code editing the refactoring way. All coding done by netbeans, I also performed using eclipse and vice-versa. So I actually coded everything twice just to find out how both IDE’s differ on refactor options. I don’t want to give a one to one transcript of my activities but to share the impressions I’ll provide simple examples.

I started with the creation of a simple Circle class. The basic polymorphism example you find in every OO book. Give it some members to store coordinates and a radius and add setters and getters. No problems of course for both IDE’s altough the getter/setter generation wizard of eclipse can not be found in Netbeans. At least not by me but since I found out getters and setters can be generated by code completion (type setR Ctrl -Space) I use the eclipse wizard only occasionally.

After the Circle class I did the same for a Square class and while coding I discovered, how trivial, both classes share the common member to hold coordinates. Time for a super class. For this task, Netbeans provides a ‘Extract superclass’ tool which does exactly what I want. In eclipse I create the superclass by hand and use the ‘Pull up’ tool to move common members and their corresponding getters/setters. This option is also available for Netbeans but their is a slight difference: The Eclipse way of doing this is through 4 wizard screens (instead of only one) and one of those screens is asking to remove redundant members. Neat! very neat. Worth the three extra mouse clicks. Not available in netbeans. But netbeans has a very slick preview window that makes previewing the concequences of your changes a breeze.

Okay, let’s introduce som jdk1.5 features. I’ve added a ShapeGroup class wich holds a reference to List<Shape> and implements the Iterable<Shape>interface. First thing both IDE’s come up with, Netbeans after an explicit compile, are the regular compile error referring to unfound symbols. Fix imports does the trick. Eclipse comes up with a wizard per unfound class, Netbeans uses one wizard to fix them all at once. I’m still runing into compile errors because my shape group class does not implement all abstract methods. I’m missing public Iterator<Shape> iterator(). To solve this, Eclipse provide a ‘implement/override methods ‘ wizard. This wizard shows all methods of all super classes and interfaces. Simply select and go. Netbeans is missing this wizard (or again, I could not find it) but netbeans has, just like eclipse, quick fixes. Press Alt-Enter on the class definition and Netbeans comes up with the suggestion to implement the abstract methods. Works! Almost!

This is what eclipse was generating:

public Iterator<Shape> iterator() {
// TODO Auto-generated method stub
return null;

And this is what Netbeans generated

public Iterator<T> iterator() {

See the sligth dfifference! Yep the eclipse generated code does compile while the netbeans generated method does not. More important, eclipse applied generics correctly and netbeans not (see the return type). A bug I hope (or do I need to some free wrestling with code generation templates??).

I can go on with these examples, I’ve renamed classes, moved them deleted them (Netbeans has a ’safe delete’ option giving you control over the delete proces, very handy) but the results are constantly more of the same. Both IDE’s do their thing, each on its own way, but at the end I can refactor all day long without any problems.

So my conclusion is simple: the absence of refactoring tools is not an argument anymore to ignore Netbeans. They finally did it. And finally there is a good free alternative for eclipse. The next question is whether I wan’t to change IDE or not? And I have to agree, I’m hesitating. Netbeans has a lot of other pros. To name just two, very nice web development support (really love the HTTP Session inspector) and projects backed-up by generated ant files (no more build.xml coding). These things really make me happy. But on the other hand, after coding for years with eclipse, eclipse has become some kind of second nature. Difficult! On a very powerful development box (read a lot of mem) you can use both at the same time on the same project. Works! I tried it. A bit of an overkill but a provisional solution for the dilemma to netbeans or not to netbeans.

— By Okke van 't Verlaat     PermaLink

One Response to “Netbeans 5 Testdrive”

  1. Boy van der Werf Says:

    I share the dilemma. Eclipse is still me number one for me for two reasons: first of all (like you) I have grown attached to it in the last years and secondly it provides me with more than only a Java IDE.
    In contrast to Netbeans Eclipse was designed to be an IDE for other programming languages as well. Problem is that it is hard to find a good set of Development Tools other than those for Java. I would like to do all my PHP and other web (HTML) coding with it, but depite all the plugins I did not find the right ones yet. Not to speak of the fact that most of the time you will need multiple instance of Ecipse to prevent incompatibilities between the perspectives different languages.

    When considering just the Java Development I think Netbeans and Sun are closing the gap. The free version of Sun Java Studio won’t make it easier, but I think I will stick to Eclipse (for now) since it serves most of my needs. Let’s hope they make the best out of the Web and J2EE Standards Toolkits and provide a proper web application environment.

Leave a Reply


Sha256 mining

Blog Categories

Browse by Date
October 2005

Upcoming Events

Monthly Archives

Recent Comments


XML Feeds Option

Get Firefox  Powered by WordPress

code validations
Valid RSS 2.0  Valid Atom 0.3
Valid W3C XHTML 1.0  Valid W3C CSS