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."
Tutorials and Documentation
The easiest way to get started is to go through netbeans.org's
Ruby tutorials.
"I just installed M10 and ran through
[the
Creating a Ruby Weblog in 10 Minutes] tutorial and
the Flickr one,"
an enthusiastic Joe Bowbeer writes the netbeans.org team, and concludes:
"A lot of fun and no hitches."
Even if you are new to Ruby you can use the IDE and its sample applications
to familiarize yourself with the concepts and syntax.
"The rdoc popups give a very quick insight into the language," Tukker notes,
and adds, "since I started using these features, I don't have to look into the
Pickaxe book
as often as before."
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
Make sure you have a current Java Development Kit installed
(download)
Download the NetBeans IDE 6.0.
(download)
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:
- 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.
- 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.
- You can also access Rake targets from the context menu if you have defined any.
Further Information
Related Links
- Ruby Development with NetBeans IDE — Home
- Ruby Development with NetBeans — tutorials
- The Ruby wiki with the latest feature news and screenshots.
- The Ruby for NetBeans project
Sources
- Roman's
NetBeans Podcast: Tor Norbye talks about Ruby
- Tor Norbye's Blog
- Meet Joe Bowbeer at the OOPSLA conference
in October 2007.
- Coté's Blog about Eclipse and NetBeans.
- Coté's and Charles'
Podcast about Ruby and Java IDEs.
- Michael Slater's Blog about Ruby IDEs
- Klaasjan Tukker's NLJUG