Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Nick Plante

Dr. Dobb's Bloggers

Those Other Ruby Web Frameworks

February 28, 2008

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...

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.