Ruby and Rails — How NetBeans Changed my Life

From version 6.0 on, the NetBeans IDE's support for Ruby is as comprehensive as it is for Java, covering the full edit-compile-test-debug cycle for Ruby and Ruby on Rails.

Klaasjan Tukker, the president of the Dutch Java User Group NLJUG, web developer Michael Slater, software industry analyst Michael Coté, developer and software consultant Charles Lowell, and the Java technology consultant Joe Bowbeer, were among the first ones to give the new Ruby features a try.

Here is what they said!

The First Impression

Klaasjan Tukker first came into contact with Ruby and Ruby on Rails in 2006. Like many Ruby developers he soon felt that, instead of a text editor, he needed an IDE that understood Ruby code semantically.

"Having worked with Java and PHP, Eclipse was the IDE of my choice, and so I downloaded the RadRails plugin. The plugin supported basic Rails commands like scaffolding and project creation. Code highlighting and 'templating features' were not quite common at that moment," Tukker remembers.

"Early 2007 I got hooked on the NetBeans module for Ruby and Ruby on Rails," Tukker adds. "In my day-to-day job, I manage an in-house Java development team. In the evening hours, I've built a simple membership administration system for the NLJUG. NetBeans supported this development quite nicely."

Michael Slater has a similar story to tell. He develops web applications with the Ruby on Rails framework and he too was using RadRails. Then in July 2007, one morning changed his (work) life.

"[T]his morning I downloaded NetBeans. It took me about two hours to download it, figure out how to use all the core Rails features, and get a few projects imported into it from my Subversion repository. By the end of those two hours, I knew I'd be unlikely to use Aptana [RadRails] again," Slater writes in his weblog.

NetBeans Tip: Did you know that Control-K automatically completes any previously typed strings from within the same editor? Similarly, Control-L completes previously typed strings found after the insertion point. Press either shortcut repeatedly to cycle through all possible completions.

"NetBeans just feels more capable and more polished, and while I found a couple bugs (using the latest [milestone] release), it was much more stable than the current Aptana release," Slater continues. "By mid-day I felt at least as productive in NetBeans as I ever was in RadRails."

Developer Michael Coté, too, was positively surprised by how easy it was for NetBeans IDE users to get started with new features. He got curious about the IDE's Ruby support while doing research for a comparison of the Netbeans and Eclipse platforms.

"NetBeans typically wants to first tell you how to start pounding nails, while Eclipse wants to first tell you about the hammer." Coté sums up his impression in his weblog. "[C]heck out the NetBeans Ruby page versus the Eclipse Dynamic Languages Toolkit page: The fact that NetBeans goes with the specific —Ruby— over the general —dynamic languages— is really all you need for the 'ready-to-use tool' vs. 'tool for tools' frame."

Features and User Interface

Although the full version of NetBeans IDE 6.0 will only be released in a couple of months, you can already test current development builds and give feedback on new features.

"The speed of development of the team is amazing. The cutting-edge features are mostly built upon the latest builds of NetBeans IDE 6.0," Tukker describes the results of his hunt for the best tool. "I became a frequent visitor of the Development Download section of the NetBeans website. About once a week, I update my installation to the latest NetBeans IDE 6.0 and Ruby IDE build."

Michael Slater still recalls his first impression of the Ruby project support: "Some of the features I immediately appreciated were the code hinting, ability to split the editor window into multiple panes either horizontally or vertically, better UI for accessing generators and Rake tasks, highlighting of the begin and end of Ruby methods, blocks, and HTML statements, and marking of where in each file code has been deleted and inserted."

NetBeans Tip: Use shortcuts to speed up your work: Typing a colon and then hiting the tabkey inserts a hash entry of the form :key => "value". Pressing # inside a double quoted string will insert #{} with the caret in the middle. See the lost of all Ruby keyboard shortcuts in NetBeans IDE.

And he is not alone: "First of all the project support is super," Tukker confirms. "Also the code completion and refactorings are very powerful."

"For a Ruby IDE, mostly I'm looking for code completion," Michael Slater agrees, referring to the same standard feature for Java IDEs: Code completion speeds up typing by popping up a list of all options that you have at this spot in your code.

Unlike Java however, Ruby is not only a dynamically typed language, its syntax is also a lot more flexible. This is why type inference — and thus code completion — for Ruby is "not an accurate science," explains Tor Norbye, well-known in the community as the developer who currently implements the necessary completion heuristics.

Web application developer Michael Slater is of course especially intersted in the IDE's Ruby on Rails features. "The appeal has at least as much to do with Rails and with Ruby, for which you need easy access to lots of files," he comments on the quality of the user interface; "It helps to have easy access to Rake tasks, starting Rails servers, and other Rails-specific items."

Charles Lowell's favorite NetBeans feature is the Ruby debugger. "You can use the cruby debugger or jRuby; Netbeans by default uses the jRuby VM for your projects, but there is no reason you can't run it with regular Ruby. Either way, you get really nice debugging hooks into the code," Lowell points out in his and Coté's recent podcast. "As you're stepping through the debugger, all your code browsing, completion, documentation information, it's all there, in a way that it's not in Eclipse or Textmate. So I do use it for debugging, really sweet."

So, is there nothing more to wish for? Well, almost nothing. "There are always nice features you could wish for," Tukker admits, "like a colored output console, or an integrated tail module."

Conclusion

"I find it amazing that products of the richness of Aptana and NetBeans are free," Slater complements the NetBeans and Aptana development teams in closing. "They're easily as deep and sophisticated as most of Adobe's $500+ products, for example, and they're evolving a lot more quickly."

NetBeans Tip: Did you know that you can open files that are not part of a project in the Favorites window? Select Windows > Favorites for a customizable file browser. You can also choose Navigate > Go to File or Go to Type from the menu to search for files and resources in your projects.

Coté agrees that NetBeans IDE is one his top two options for Ruby development. "If I were to start writing code again full-time (Java or Ruby), I'd certainly check out NetBeans for a while and compare it to Eclipse," and he admits, "I wouldn't have considered a non-Eclipse option until recently."

If you are not convinced yet, Coté has a message for "all you horse-race, zero-sum fans" out there when he states "[W]e'll have to keep our eye on NetBeans 6.0. It's looking slick, esp. with the Ruby support and Jackpot."

For the JUG-leader Tukker there is only one thing he regrets: "The NetBeans Ruby IDE is still very unknown amongst Java and Ruby developers." But he is doing all he can to change that: "When I visit a conference (both on Java and Ruby), I am happy to show off the wonderful IDE in the making. Keep up the good work!"

Thank you all for your surport and constructive feedback!

Get NetBeans IDE for Ruby

Installation and Download

  1. Make sure you have a current Java Development Kit installed (download)

  2. Download the NetBeans IDE 6.0. (download)

  3. Run the NetBeans installer and click Customize. Check at least "Ruby IDE" and "Base IDE". This will install NetBeans IDE including support for Ruby, Rails, the Mongrel server, CVS and Subversion.

Note: As an alternative, a prototype Ruby IDE build exists with only cvs/subversion, local file history, Ruby, and Rails installed. Get the Ruby-only NetBeans IDE here.

How to import and run Ruby Projects in NetBeans

You want to integrate your Ruby scripts with Java code? Then we recommend using the default JRuby interpreter. JRuby runs on the Java Virtual Machine and is already built into the IDE. In all other cases, feel free to set the IDE to use your system's Ruby interpreter.

You can always go to the Miscellaneous Options > Ruby panel to switch from one Ruby interpreter to the other. Note that switching to another Ruby interpreter also switches to the associated Rails interpreter.

To get started:

  1. Select New Project from the File menu. Create a new project or use the wizard to create a Ruby project from existing sources. The wizard assists you with Ruby as well as Rails projects.
  2. The new Ruby project will appear in the Project window. Right-click the project and select Run from the context menu to compile and run the application.
  3. You can also access Rake targets from the context menu if you have defined any.

Further Information

Related Links

  1. Ruby Development with NetBeans IDE — Home
  2. Ruby Development with NetBeans — tutorials
  3. The Ruby wiki with the latest feature news and screenshots.
  4. The Ruby for NetBeans project

Sources

  1. Roman's NetBeans Podcast: Tor Norbye talks about Ruby
  2. Tor Norbye's Blog
  3. Meet Joe Bowbeer at the OOPSLA conference in October 2007.
  4. Coté's Blog about Eclipse and NetBeans.
  5. Coté's and Charles' Podcast about Ruby and Java IDEs.
  6. Michael Slater's Blog about Ruby IDEs
  7. Klaasjan Tukker's NLJUG
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo