Columns

Sun adds to open-source Java IDE roster

Java as a programming language requires very good design skills. .NET programmers know this, as well, because C# and VB.NET are built on the same single-inheritance, strictly class-oriented programming model as Java. It starts off simple, but as the number of classes grows it can become quite complex with intricate dependencies.

So it’s no surprise that Java’s major developers are trying to simplify and accelerate Java development. A particularly good example of this trend is Sun’s NetBeans, which has been remodeled in the Visual Studio mold.

NetBeans has really improved in the last two years. The interface is very easy to work with. Don’t like where a window pane is set? Just grab it by the title bar and drag it to a new position. If there’s a window pane already there, NetBeans just drops it in as a tabbed pane. The new property sheets apply to any object in the FileSystem or Runtime treeviews, so quick configuration changes are simple to do. The GUI designer doesn’t allow source-code edits of GUI constructor and definition code, but the connector wizards and event skeletons make GUI developers very productive. And NetBeans is highly customizable and extensible through its many configuration options and plug-in modules.

As just an editor, NetBeans has a great story. Just a few of the editing goodies that NetBeans offers are color-coded syntax, folding lines, a treeview pane of file and object info, and dynamic code checking.

Dynamic code checking is a particularly useful feature. As you enter your code, NetBeans not only does the code completion, but parses and checks the code for syntax errors, which are flagged with a wavy red underline. Hold your mouse over the wavy red line and an error explanation pops up.

Another winner is method templates. Type in setFont() and NetBeans lists the five methods with dummy parameters for setFont(). Or think customized abbreviations for all the different files you edit. The combination of code completion, function or method templates, plus dynamic code checking, not only makes NetBeans developers very productive, but also increases their rate of learning.

The NetBeans editor can be customized for Java, CSS, XML, DTD, JSP and HTML pages. Abbreviations, code completion and indentation can be turned off and on, and customized in detail. The editor also supplies start-up coding templates for new Ant, Java Applet, Java Application, JSP and other starting file types, including several Java GUI and JUnit test types.

Strangely, projects are simply defined in NetBeans with name and main execution class. The real action takes place at the FileSystems, Property and Runtime tab panes that come with each project. NetBeans remembers all the windows, files and even the exact state of execution when switching between projects. Unfortunately, it does not remember your last layout for all the window panes and tabs, including their size and location on screen, like Eclipse does. In fact, the current version of NetBeans resizes and displaces tabs and window panes between invocations.

The FileSystem tab is quite powerful, however. It is used to maintain the vital CLASSPATH automatically by adding and removing directories. The result is a hierarchy view of all the Java files, their classes, methods and beans. In addition, the FileSystem tab exposes HTML files, XML descriptors, beans and other resources. The Runtime tab does the equivalent for back-end servers. And if you have the Properties tab open, it will immediately display the detailed properties of any file system or runtime resource ready for editing.

The IDE comes preloaded with Ant for complex builds and deployments, JavaDocs for help and code documentation, JUnit for program testing, and VCS-Version Control System for team development. Each is supported directly in the menus and with a number of custom dialogs. Adding new modules is accomplished by simply clicking on the Tools/Update Center menu item and following the dialog wizard.

NetBeans has emulated such Visual Basic GUI staples as property sheet, component palette and component treeview. But it has gone VB one better, borrowing Visual CafÈ’s Connector wizard, which helps to link source to a GUI component and then link that with some target component. This wizard, in effect, defines the only possible changes between the two components. Users then select which change they intend to use from a list.

The property sheet’s events are utilized to list all the possible events for each component and to then generate the skeleton Java code needed to respond to the selected event. Some may insist that it’s easier to lay out and code GUIs from the text editor. But for the rest of us, the NetBeans GUI certainly helps.

There are some distinct limitations to the GUI interface, however. The definition code it generates is tinted blue and not changeable in the editor; developers must use the designer and property sheets to change GUI component definitions and properties. Also, there are no database-aware components. And the selection of third-party components is fairly small, though it is beginning to grow.

As NetBeans moves up the development chain, it definitely starts to rely more on open-source and third-party tools. I had no problems whatsoever with batch, GUI application and GUI applets using NetBeans. Compiles can be configured to use external Java toolkits on a project or file basis. And there are numerous other compile-time configurations. But the move to Web server and true n-tier applications means that using Ant for the compile/build option is essential for high productivity. NetBeans can still deliver, but Ant allows conditional tests of compile results plus creation and movement of the XML descriptor, .class and .jar files needed for setting up Web servers test properly -- and all in one file setup.

When users graduate to JSP and EJB apps, NetBeans’ lack of strong refactoring, its support for simple databases only and its rudimentary Web services facilities makes it a less-desirable tool vs. popular commercial IDEs. Planned upgrades and third-party add-ons for refactoring and better basic J2EE Web development support will improve the tool, but NetBeans can move only so far before it starts to infringe on its sibling, Sun Java Studio Creator.

But there is no denying the robust capabilities of the NetBeans debugger. It has user-selectable breakpoints and watches, either of which can be conditional. This developer found the NetBeans debugger to be almost embarrassingly quick in revealing my “coding oversights.” The new Web module for debugging Servlets, JSP, and even J2EE 2 is not trivial to set up, but works serviceably.

NetBeans Java IDE
Sun Microsystems Inc.
Santa Clara, Calif.
800-555-9786
www.sun.com 
Rating 4.5 stars out of 5

Description: A free, open-source IDE equal to, and in some cases better than, Eclipse or other commercial IDEs as a development tool for all Java applications except J2EE enterprise systems.

Bottom Line: NetBeans is a versatile and highly configurable editor that stacks up very well against Eclipse. The key difference is that the NetBeans editor ties in well with additional functionality, such as the project manager, the GUI designer and the debugger.

NetBeans has proved to be another example of how open source can deliver the highest quality development tools. It qualifies as a top-notch tool for every aspect of Java development -- from J2ME to GUI applets and applications to Servlets and JSP -- leaving J2EE for the big boys. For organizations looking for long-term value, NetBeans certainly delivers as the base for Sun’s Java Studio series of development tools.

Pros:

  • Superb editor and powerful debugger set into a very customizable IDE. 
  • Highly usable with Ant, JUnit, Javadoc and version control support. 
  • Great value.

Cons :

  • Resource-hungry -- needs Pentium 600Mhz with 256MB of RAM on Windows minimum. 
  • Only simple database, Struts, J2EE and Web services support is included. 
  • Mixed quality documentation and third-party books.

About the Author

BIO: Jacques Surveyer is a trainer, consultant and Web developer. See his graphics tips at thePhotoFinishes.com.