Those Other Ruby Web Frameworks

Most Ruby developers tasked with building web applications are clearly working in <a href="">Rails</a> at this point. However, there are some great alternative fram

InformationWeek Staff, Contributor

February 28, 2008

5 Min Read

The Pragmatic Programmer has long advocated that it's good practice to learn at least one new programming language every year. If you're a web developer, it's at least as important to pick up a new framework from time to time.

Most Ruby developers tasked with building web applications are clearly working in Rails at this point. However, there are some great alternative frameworks out there that also deserve a look. Do yourself a favor and dig in; learning a different framework can change the way you think about the box you're working in.

Some of these frameworks borrow heavily from Ruby's premier web framework. Many offer significant improvements in speed and flexibility. Some can be used as outright replacements for Rails. Others are perfect for running as supplemental services, when something faster and closer to the metal is needed (consider the case of handling large file uploads). And a few have entirely different goals in mind, such as providing a whole web application stack in a single file for easily deployed mini-applications. But despite all their differences each of these frameworks have at least two things in common: a great dynamically-typed human-friendly base language (Ruby!) and a smart, enthusiastic core group of contibutors.

Note that this list isn't intended to be exhaustive; if your favorite isn't included, make sure to leave a comment and a link.

  • MERB: Probably the most popular alternative to Rails, Merb is a smaller, tighter framework that's easily extensible, thread safe, faster and less opinionated. However, it maintains many similar conventions so it should be relatively familiar to existing Rails developers. With Merb you can take your pick from DataMapper, Sequel, or other Object Relational Mapping (ORM) libraries, rather than being married to ActiveRecord. You're also free to choose templating engines (Erubis, HAML, Markaby, Liquid, etc) and JavaScript libraries (JQuery, Prototype, YUI, etc). The Merb community is vibrant and growing very quickly. The current gem version is 0.5.3 but a new 0.9.0 version has seen a recent development release, and the 0.9.1 gem should be arriving shortly. It's also worth mentioning that, starting with 0.9, Merb runs on top of Rack[1], a Ruby webserver interface.

  • CAMPING: A micro-framework weighing in at less than 4k, Camping was developed by prolific Rubyist _why back in early 2006. It uses Markaby for representing HTML in pure Ruby code and ActiveRecord for database access. Ideal for writing single-file mini applications (served with or without chunky bacon).

  • SINATRA: A recent entry into the Ruby web framework space, Sinatra is designed as a minimalist RESTful framework that sits on top of Mongrel. It's core is a simple domain specific language for defining RESTful actions and responses. Also ideal for single-file mini-applications. ORM agnostic and built on Rack.

  • WAVES: A new "next-generation" framework that leverages Rack and Mongrel (for HTTP interfacing), Sequel (for ORM), and Erubis/Markaby for view templates. One interesting feature of Waves is its use of request lambdas, which means that whole requests are mapped to a block of code rather than matching simple paths to a controller with a set of implicit actions.

  • RAMAZE: A flexible but full-featured alternative that can be used to construct MVC-style applications as well as single file embedded Ruby templates. Ramaze seems to be less opinionated than either Rails or Merb and has been under active development for more than a year. It supports any Ruby ORM and ships with JQuery for a JavaScript library. Built on Rack and runs on both Ruby 1.8 as well as 1.9 (!).

  • HALCYON: Small and fast, but the real distinguishing characteristic here is its exclusive use of JSON for requests and responses to/from AJAX client applications. Another big win is that it's extremely well documented, in stark contrast to many of its competitors. It's also built on top of Rack.

  • SWIFTCORE IOWA: The grandaddy of Ruby web frameworks, IOWA was originally developed by Avi Bryant as a port of the NeXT WebObjects system. Kirk Haines has since taken over the project and revamped it, providing support for evented and clustered modes of operation as part of the Swiftiply project.

  • NITRO: Another long-standing option that predates Rails. The Nitro project also includes Og, an alternative ORM package.

Clearly there are a lot of options. So should you ditch the Rails kool-aid for [Merb, Waves, Sinatra]? Well, no, not necessarily. It really depends on your situation. Rails itself is a fine web framework, and there's a reason it's drawn so many people into the world of Ruby. At this point it's well established and relatively mature, and supported by a top-notch community; there's little doubt that it will continue to grow and thrive for quite some time.

With that said, monoculture is rarely a good thing, even in development circles (surprise!). Having this variety of web frameworks is healthy for the Ruby community. It not only gives developers options but also allows for exploration of innovative ideas that may not "fit" inside the Rails aesthetic.

Check one of them out if you have the opportunity; I think you'll be glad you did.

[1] Rack is a framework for building web frameworks, sort of a standard interface between Ruby web servers and Ruby web frameworks with a simple API (similar to Python's Web Server Gateway Interface). A large number of these web frameworks are built on top of Rack, which is a Good Thing. We'll be talking about exactly what this means and why it's important next time...

Never Miss a Beat: Get a snapshot of the issues affecting the IT industry straight to your inbox.

You May Also Like

More Insights