Ruby on Rails on track for major upgrades

Templates, modularity featured in roadmap that includes merger with rival Merb framework

It is looking like a very busy year for the popular Ruby on Rails Web application development framework, with multiple enhancements anticipated in an upgrade due this month, followed by a merger later on with the Merb Web framework.

First on deck is the 2.3 release of the open source Rails framework, set to feature performance optimizations, customizable templates, memory savings, and the ability to write the most performance-dependent parts in Ruby. Rails 2.3 also features HTTP Digest Authentication, an API for authentication.

[ How do Ruby IDEs compare? InfoWorld's Strategic Developer blogger Martin Heller finds out. ]

"It's getting pretty close to being done," with an expected release this month, says David Heinemeier Hansson, creator of Rails and a partner at 37signals, a Web application development company.

Rails 2.3 takes early advantage of Merb strengths
While Rails 3, expected in an early format around May, serves as the merged Merb-Rails release, Version 2.3 in some ways serves as a precursor to Version 3, with performance boosts brought over from Merb, Hansson says.

For example, the respond_to block capability in Rails, enabling an application to respond to a single request with HTML, XML, or JavaScript, has been made 8 percent faster in Version 2.3 by Yehuda Katz, the new Rails core team member coming over from Merb, Hansson says.

Other Version 2.3 changes are unrelated to Merb. For example, the new templates capability enables creation of templates already fitted with specific capabilities such as plug-ins, instead of just having a bare-bones, skeleton template, Hansson adds. A plug-in could be added, for example, to ensure that an application is tested by the RSpec framework rather than the default Test::Unit framework. A pagination plug-in also could be included in a template.

The Rack function in Version 2.3 serves as a piece of shared infrastructure, enabling different Ruby frameworks to work together more easily. A developer, for example, could add in to a Rails project a piece of an application built in the more lightweight Sinatra framework, Hansson says.

The Rails Metal capability in Rails 2.3 lets developers author part of an application directly in Ruby rather than in Rails, to boost performance. "Rails Metal is basically an assembler for Rails, where you throw away all the premade functions and so on that you normally have and use [it] to be extremely fast on a tiny part of your application," Hansson says.

The blockbuster Rails 3 brings in the best of Merb
As dramatic as some of the features are in Version 2.3, Ruby 3 looks to be the bigger blockbuster upgrade. A release candidate is hoped for at the RailsConf conference in Las Vegas in May, Hansson says, though the development is early enough that he calls it "still in some ways vaporware."

But Hansson assures that Rails 3 will take full advantage of the competing Merb effort, which is now being merged into Rails. The Rails-Merb merger, announced on Dec. 23, came about because the Rails and Merb teams basically realized they wanted the same things, Hansson says.

"All of the Merb guys are former Rails developers, and they started Merb because they had a number of issues that they cared about," such as performance optimization and agnosticism pertaining to frameworks used with Rails, Hansson says. For example, Rails has used Active Record for object relational mapping, whereas Merb proponents wanted to use DataMapper or Sequel, he adds.

Rails 3 will bring over ideas from Merb, such as framework agnosticism that will gel with Rails' emphasis on strong defaults, Hansson says. Merb's idea of published API for extending Rails with plug-ins also will be part of the mix.

"Right now, Rails has an incredibly bad ecosystem for plug-ins," Hansson says. The plug-ins tend to break when Rails is updated because of the lack of a clear-cut API, he adds. Also being brought over from Merb is routing, for the mapping of browser requests. Merb offers more options in this regard than Rails has, Hansson notes. (Afterward, Hansson clarified that Rails has an "amazing" ecosystem for plug-ins, but stressed the issue with breakage upon upgrade.)

Merb focused on parts of the Rails stack that the Rails effort did not, Hansson says. Katz, the maintainer of Merb, says the Merb framework originally was built to solve a problem with asynchronous processing in Rails. "At the time, Rails was a single-threaded application, so using a Rails process to handle, for instance, file uploads was a nonstarter," he says. "Merb was created initially specifically to solve the file upload problem but very rapidly became a sort of rallying point for people who were dissatisfied with Rails for other reasons."

The two-year-old framework has offered spirited competition with Rails, but fundamentally, the two technologies were headed in the same direction, Katz says. (Both Merb and Rails are derived from Ruby, and both are open source projects.) "What happens now is the Merb guys have chosen to basically join into the Rails camp," Hansson reports. "Bringing both teams together will make it easy for us to produce a framework that has the benefit of Rails' maturity and community, with Merb's relentless focus on a defined API, modularity, and performance," Katz adds.

Hansson offers assurances to Merb developers migrating to Rails: "The hope is we're going to do everything we can to make it as easy as possible. You're not going to have to rewrite your entire app," he says. There will be some changes required, but the project expects to offer techniques to make them, Hansson notes.

As Rails and Merb make peace, others may splinter off
Rails consultant Jade Meskill notes he had read brief online commentary criticizing the uncompetitive nature of the merger, which unifies the two frameworks. But Meskill was nonetheless supportive, stressing the unity it provides in the Ruby community. "While competition is definitely valuable, there comes a point especially with this community, with this particular [technology], where it's leading down the destructive path of a huge fracture" between Merb and Rails, says Meskill, president of Integrum Technologies and a co-founder of the Phoenix Rails user group.

"It's just been a really nice community, and this split was starting to create division between the best Ruby minds that we have," Meskill says. He anticipates "great things" resulting from the merger, such as more adoption of Ruby as a development language and Rails as a Web platform.

The merger does provide unity, but someone will likely come along and form yet another similar project, says analyst Al Hilwa, program director for application development software at IDC. "There might be a sort of Merb reloaded," he notes.

One concern developers may have from the Rails-Merb merger is the complexity of the effort. "It's going to be interesting to watch how a rather large, not-so-mean-and-lean framework like Rails is going to offer the modularity" of Merb, Hilwa says.

Copyright © 2009 IDG Communications, Inc.

InfoWorld Technology of the Year Awards 2023. Now open for entries!