Lab test: Climb aboard Ruby on Rails
The Ruby on Rails site bills its eponymous project as "Web development that doesn't hurt." I'm not really sure what that means, but it certainly sounds good.
Further down on the page, it says, "Rails is a full-stack framework for developing database-backed Web applications according to the Model-View-Control pattern. From the Ajax in the view, to the request and response in the controller, to the domain model wrapping the database, Rails gives you a pure-Ruby development environment. To go live, all you need to add is a database and a Web server." That's almost true.
On the Rails download page, after some basic installation instructions for installing Ruby, RubyGems (the standard Ruby package manager) and Rails, as well as some terse hints about how to get started, there's some advice about Rails editors: "The entire Rails core team is using TextMate on Mac OS X. It's a fantastic editor that ships with Ruby on Rails highlighting and macros. If you're not running Apple, check out RadRails. It's a cross-platform Rails editor built on top of the Eclipse IDE."
The Rails team never tries to disguise its enthusiasm for Mac OS X, but it has given short shrift to developers who prefer other platforms -- so let's amplify the Rails Editors and IDEs story a bit.
Something for everyone
I have personally used three operating systems for Rails: Linux, OS X and Windows; a fourth supported OS is Solaris. There are four Ruby VMs that can run Rails: plain old Ruby, JRuby, Rubinius and IronRuby. I have done all my Rails development on Ruby rather than any of the alternate VMs. Your intended development OS will likely constrain your choice of editor. If you are hell-bent on using JRuby, Rubinius or IronRuby, that could also limit your choice of editor.
Test-driven development is very common in the Rails world. When you're developing a Rails application, you typically start by doing some code generation, using a number of handy shell scripts. Once you have a skeleton application, you typically build it up incrementally by adding and coding models and actions, adding and coding tests, running and debugging the tests, refactoring, adding Embedded Ruby pages to generate HTML views, testing the HTML display in a browser, and viewing the server log. If you need AJAX, many actions and effects can be generated entirely from Ruby, but more complicated or uncommon effects usually require some coding and debugging in JavaScript.
In the course of all this, you'll find yourself constantly moving among the test, model, controller, helper and view code, and popping among editor, browser and shell windows. An IDE and/or some editing shortcuts can cut down on the amount of time you spend popping around.
When it comes to code editors, one size does not fit all. It never has. Even in the early days of the Arpanet, not everyone who programmed on the PDP-10 used TECO; later on, Unix developers argued fruitlessly about the relative merits of emacs and vi. Emacs and vi (or xemacs and vim, if you prefer) are still options, by the way: Both have plug-ins for Ruby and can be used effectively for Rails development, along with a browser and a command shell. Other editors that can be used for Rails in combination with a browser and a command shell include SciTE, SlickEdit and jEdit.
Bundles of joy
So why do the Rails core developers swear by TextMate on the Mac? Simple: Early on, they built "bundle" (essentially macro) extensions for TextMate as tooling for Ruby and Rails programming.
Bundles give you incredible power, at the expense of needing to memorize keyboard shortcuts for efficiency. The bundle approach to automation makes eminent sense for a developer who lives in one code editor all day. On Windows, the bundle approach can be found in the TextMate-inspired E Text Editor and InText; both include a Ruby and a Rails bundle.
Why does the Rails team suggest RadRails for everyone else? Basically, it's an integrated GUI development environment for Rails, and it runs wherever Eclipse and Java run. Also, Aptana RadRails Community Edition is free.
Several other products follow the RadRails integration approach to Rails development: 3rdRail, Komodo, NetBeans, IntelliJ IDEA, and Ruby in Steel. They all play variations on the theme, but if you know one, you'll that find that the others look familiar.
You don't have to restrict yourself to one tool, either. You can mix and match tools for a complete set of functionality. For example, on the Mac, you might want to mix TextMate, which gives you power editing via its Rails bundle, with either NetBeans or RadRails, both of which are free IDEs that have debuggers.
In this review suite, I've covered the Rails IDEs and the editors with Rails bundles. See the individual product write-ups, pros/cons and features tables for more on each product.
SapphireSteel Ruby in Steel Developer Edition 1.2 and Text Edition 1.1.5
In my brief review of Ruby in Steel 1.0 from early 2007, I said, "Any serious professional Ruby developer who has a copy of Visual Studio 2005 Professional or above should at least try out Ruby in Steel Developer. If you're like me, the asking price will seem cheap for the combination of the fast debugging and the great IntelliSense support."
The Ruby in Steel product is now up to Version 1.2, which is one of the critical milestones on its road map, as it introduces Visual Rails Workbench, a Web page designer for Rails that supports Embedded Ruby and templates. That's a significant accomplishment.
At this point, the product has most of the Rails integration features that I missed in 1.0, plus some bonus features that I didn't know I'd want, such as a fast JRuby debugger. (See the full feature list for both the Developer and Text Editions.)
The Visual Rails Workbench, the fast debugging and the great IntelliSense support are the three core features that differentiate Ruby in Steel 1.2 Developer from the Text Edition. The performance hit from debugging with Cylon is barely noticeable, which is not the case with the standard Ruby debugger. There are also mind-blowing dynamic debugging scenarios that work in the Cylon debugger.
Right now, the Visual Rails Workbench can be a little funky when it comes to synchronizing an overall page design with its components, but SapphireSteel assures me that Version 1.3 will fix that issue. Later in the development cycle, the IntelliSense support will be extended to database code and user-selectable libraries, and the Visual Rails Workbench will be extended to handle RXML and RJS. You'll note that there's nothing resembling the Ruby in Steel Visual Rails Workbench in any of the other products I reviewed.
If I had three wishes for new features in Ruby in Steel that aren't currently on its road map, they would be refactoring support, better test integration than the current simple front end for "rake," and support for TextMate-compatible bundles.
A visual overview of Ruby In Steel is available here. You may also watch 10 short screencasts right here.
Aptana RadRails 1.0
When I reviewed RadRails 0.7 in 2006, I said that "all serious Rails developers should consider it for their tool kits." At the time, RadRails lacked debugging and refactoring capabilities. I'm happy to say that its refactoring is now excellent. In addition, its debugging is now sufficient for the purpose, thanks to the ruby-debug-ide gem.
My biggest gripe about RadRails in 2006 was the lack of documentation, which has since been remedied. In addition to a combined help file for RadRails and Aptana Studio, Aptana offers a number of videos. A book about using RadRails, titled AptanaRadRails: An IDE for Rails Development, -- by an independent author -- has just been published.
A full table of Aptana RadRails features is available. I would take the comparison columns that list NetBeans and 3rdRail features in this table with a grain of salt; a quick check found several features incorrectly listed as missing in NetBeans and 3rdRail. I don't think the table was current when I viewed it.
The two major RadRails features that are turned on in the Professional edition are profiling and JSON editing. Other features of the Professional edition include FTPS and SFTP access to remote sites, Internet Explorer JavaScript debugging, early access to new builds and priority support.
I encountered two minor problems with Aptana RadRails 1.0. First, it still doesn't have a visible soft word-wrap display option, which is a general Eclipse issue. Second, it generates .RHTML files for new views on Rails 2 projects that should have .HTML.ERB files.
The second problem will be addressed in a future update to RadRails, according to Aptana. The word-wrap problem has a work-around, in the form of an Eclipse Monkey script.
I was initially concerned when the free open-source RadRails project became part of Aptana. In fact, Aptana RadRails is a stronger product than RadRails could have become by itself. The combination of RadRails' Ruby and Rails support and Aptana's JavaScript support into two compatible Eclipse views makes Aptana RadRails a strong choice for people developing AJAX applications on Rails.
On the other hand, if you need any of the Professional features of Aptana RadRails and find the modest license cost a problem, you might want to look at NetBeans as a completely free alternative.
ActiveState Komodo IDE 4.3 and Edit 4.3
I have used Komodo IDE user for Python, Perl, and regular expression development for several years, and occasionally for Ruby, XSLT, and JavaScript development in the last year. When I previewed Komodo IDE 4.0 early last year, I said that "it's worth having if you do more than occasional programming in one or more of the scripting languages that it supports." At the time, Komodo was useful for Ruby scripts, but not for Rails development.
Version 4.0 basically added browser-side features to the IDE. Version 4.1 made Komodo a Ruby on Rails IDE. Version 4.2 smoothed out some features and added auto-update. Version 4.3 added Rails 2 support, unit test integration, improved global search and replace and abbreviations for inserting snippets. Version 4.4, which was released after most of this review was written, added a section list, multifile SCC commit, column editing and improved unit testing.
Although Komodo IDE is fairly good as a multiplatform Rails IDE, it's not my favorite of the group. When using Komodo for Rails development, I miss the refactoring support and navigation enhancements found in several of the other products.
A video introduction to Komodo IDE is available for viewing here. You'll find 19 short Web tours of the IDE here.
CodeGear 3rdRail 1.1
On the surface, 3rdRail seems very similar to Aptana RadRails: They're both easy-to-use Rails IDEs built on Eclipse that also have JavaScript development support. If the comparison ended there, 3rdRail would be in trouble, because the base version of RadRails is free. It doesn't end there, however; 3rdRail is an even more productive environment than RadRails.
For example, RadRails provides simple GUI front ends for Rails generators and rake tasks; 3rdRail goes one better and provides higher-level wizards that collect the necessary information in a GUI and then run a sequence of generators and/or rake tasks in an enhanced command shell.
CodeGear calls this enhanced shell "commanders" and describes it this way: Commanders "merge the power of the command line with the ease of use and productivity of the IDE. This provides the ability to dynamically switch between typing on command lines and the IDE's tools, which are all integrated into the command line. For example, output from commands adding a model or view is immediately reflected throughout the IDE. Command output is hyperlinked, so that clicking on any generated file or folder will open that in the IDE."
That hyperlinking is surprisingly useful for such a simple feature. It can be very confusing to figure out why a test failed or a Rails page threw an error. With 3rdRail, once you pick out the root cause from the command output, one click takes you to the correct line of code. In similar fashion, the 3rdRail dependencies view lets you quickly navigate to the right code from a graphical representation of the application's functionality.
3rdRail offers numerous helpers in the edit window. For example, right-clicking in an edit window brings up a context menu with more than a dozen items, many of which bring up submenus.
Because 3rdRail is more expensive than any other tool reviewed in this suite, and because some of the free tools are more than adequate for Rails development, I would suggest 3rdRail only for developers who spend most of their time building Rails and can justify the increased cost in terms of productivity gains.
To view a video of CodeGear in action, go here. For more on the product's features, go here.
NetBeans IDE 6.1
NetBeans has long been a strong Java development environment. It gained Ruby and Rails support in the last year. With Version 6.1, NetBeans is a seriously good Rails IDE.
NetBeans grew up as a Java IDE and is a Sun product, so it's no surprise that it has excellent support for JRuby. It also supports standard Ruby, however, and has a Ruby Platform Manager to let you choose the Ruby interpreter used for a project.