Original URL: http://www.theregister.co.uk/2008/01/31/netbeans_ruby_part_one/

Polished NetBeans means Ruby

Eclipse beater?

By Dr Pan Pantziarka

Posted in Applications, 31st January 2008 00:36 GMT

NetBeans and Ruby, part 1 Let's be honest, the rise of the Eclipse development platform is the best thing to ever happen to Sun Microsystems' NetBeans integrated development environment (IDE).

Eclipse rolled out a solid platform, with good performance, high levels of extensibility and a rapidly expanding ecosystem of commercial and open source plug ins. NetBeans, by contrast, has been the poor relation with low levels of industry take up, fewer users and not much in the way of momentum.

For NetBeans users the rise of Eclipse provided the impetus needed to match, and indeed to surpass Eclipse. The result? A real turnaround in NetBeans.

In this, the first of two pieces on NetBeans, I'll take a quick tour of the framework in conjunction with that increasingly popular web-scripting duo, Ruby and Ruby on Rails.

The ugly, clunky, slow and not very sexy NetBeans IDE of yesteryear has been showing signs of turn around recently. Sun's open sourcing the project helped, even if much of the open source community remains suspicious of Sun's motives.

The interface has improved, performance is a lot snappier and it has scored some definite points by homing in on areas of weakness in other IDEs (not just Eclipse).

Probably the best example of this is the Matisse graphical user interface (GUI) builder. Eclipse does not come with a GUI builder by default, instead there are a number of competing GUI builders, some open source, some commercial. It's an area that is further complicated by the fact that Eclipse is built using the SWT widget set rather than the Swing libraries that come with Sun's version of Java.

In contrast NetBeans grabbed attention with Project Matisse, a GUI builder that integrates fully into the IDE and that many developers claim is probably the best GUI development tool in the Java world. So much so that there is now even a project aimed at putting Matisse on Eclipse.

And, while both of these heavyweight development platforms are modular and extensible, NetBeans seems to have stolen a march here, too, in that it's much simpler to grab big blocks of functionality in the form of packs. Sun delivered the Mobility Pack (for development of applications on mobile devices using Java 2 Platform Mobile Edition), the Enterprise Pack (for Java Platform Enterprise Edition development in all its forms, including service oriented architectures), the Visual Web Pack (for rich internet applications), C/C++ and, new in this latest 6.0 release is a bundle of features serving Ruby.

With Sun announcing its intention to kill its homegrown Java IDEs last month, the Visual Web Pack and Enterprise Pack are to come with NetBeans as standard.

The Ruby additions turn NetBeans into an IDE that can be used either with Ruby or JRuby (the latter a version of the language with an interpreter written in Java that targets the Java Virtual Machine rather than the normal Ruby run-time environment). What's more NetBeans also includes support for the Ruby on Rails framework, enabling development of Ruby on Rails projects with either Ruby or JRuby.

The first thing to note about this Ruby support is that it's possible to download and install a version of NetBeans specifically geared to that platform, (it includes JRuby and Rails), in the form of a relatively slim 20MB.

For those developers who aren't interested in the Java side of things, or who don't want any of the other features included in the fullest versions of NetBeans, it means that you have a tool that's stripped down and focused. On the other hand, those Java developers who want to play with Ruby can also download the Ruby version and install it over their existing NetBeans 6.0 Java release and get everything in one shot. For me, at least, it was a lot simpler than attempting to load Ruby support via the plugins option.

In terms of functionality, you get the full range of IDE support for Ruby. Editing is syntax colored, keywords are highlighted, there's auto completion, and errors in code are flagged up as you type. There are some nice touches in this department, such as the highlighting of potential side effects when a block variable aliases a local variable - as in the following code:


code = (1..10)
puts code
code.each { |code| puts code*code}
puts code 

There is also support for the usual scaffolding of Rails projects - each Ruby project gets a Rakefile, and there's support for unit testing too. Running applications from within NetBeans is straightforward, as is using the debugger.

For those building web applications using Rails there is support for plumbing in your back-end database of choice, with MySQL being the default option. Given the recent purchase of MySQL by Sun, it is likely that the integration into NetBeans (for the Java side as well as Ruby) will get even tighter.

There are some areas where there's definitely room to improve on things. Refactoring support, for example, is pretty limited - you can rename classes, fields and methods and that's about it.

Right now the Ruby IDE arena is becoming pretty crowded, with a number of offerings jostling for prominence, many of them from vendors and projects with a heavy Java bias including Eclipse, IntelliJ and CodeGear.

The NetBeans of today, though, is a long way from the bloated and poorly performing beast it was a few years ago. Indications are that perceptions are changing, too, and that in the case of Ruby at least, NetBeans is closing the gap on certain rivals.®