Rails Alternatives: Merb, Sinatra & Ramaze

Over the past few months I’ve been on the hunt for a Ruby web framework to replace Rails as my weapon of choice when building an online presence. Rails struck me as being overly heavy in this context and I wanted something lighter.

I was primarily looking for a web framework that, out of the box, supported a healthy variety of template/ORM options, offered flexible routing and good layout/view support.

My search took me through the green pastures of Merb, into Sinatra’s glitzy jazz hall and finally into the land of Ramaze.

Merb’s Green Pastures

I had heard so many good things about Merb that starting with it seemed like a no brainer. The rewrite of xambr.com using Merb was mostly an enjoyable experience – Merb was able to do everything I was doing with Rails out of the box.

There were annoying holes in the documentation but nothing that couldn’t be filled in through a bit of spelunking in the code base – which was pretty clean and easy to understand (at least the parts I looked at were).

Of course, a couple days after finishing the rewrite of xambr.com I read that Merb was to be merged into Rails v3. At first I was a little dismayed but I’ve come to the opinion that the merge is a good thing – Rails will definitely benefit from it and I think Merb’s spot will be taken by the very capable, if under-appreciated, Ramaze.

I ran xambr.com on Merb for about 3 months during which time I dabbled in Sinatra (previously blogged about here). These first experiences with Sinatra were very positive and I liked the fact that it was lighter than Merb – so I figured I’d give it a shot.

Getting Classy with Sinatra [Redux]

While the rewrite of xambr.com in Merb had taken about 10 hours the rewrite in Sinatra took 1/2 that time… or at least 90% of it did.

I got hung up when trying to figure out how to have multiple view sections within a single layout (like Merb’s throw/catch system). Several hours of searching and tinkering didn’t turn anything up other than a tidbit on Github using Haml – which I was not able to get working with Erubis (and I didn’t want to switch to Haml).

Its very likely that with a bit more poking around, maybe hitting up the mailing list or IRC, a solution could have been found but I didn’t want to spend any more time with it – as mentioned above I was looking for a web framework that did all of this out of the box.

So I was a little disappointed, but I still think Sinatra is a great little web framework – just not for online presences (or at least not xambr.com).

Ramaze FTW

I stumbled upon Ramaze several months before starting this little adventure but never gave it the look it deserved. Revisiting it was the best thing I’ve done all year (code wise anyway). How can one possibly argue with “Any ruby, any adapter, any ORM and any template engine” – contortionists everywhere are jealous of Ramaze’s flexibility.

Rewriting xambr.com in Ramaze took about the same time as it did in Merb – roughly 10 hours. I started off using Erubis but ultimately ended up using Nagoro – mainly because I liked its “Page Elements” which are like partials only better. Nagoro is pretty close to Erubis but I’d say its a little more natural if you’re coming at them both with a fresh slate (due to its substitution syntax).

Ramaze has a great community too – a question I posed on the Ramaze IRC channel about some odd Nagoro behavior got an immediate, friendly response from Ramaze’s creator, Michael Fellinger. Now, I’m not a frequenter of IRC channels in general so I wouldn’t know if getting friendly answers from a technology’s creator is the norm but to me it was a much appreciated surprise (thanks Michael!).

The documentation for Ramaze isn’t quite complete but its pretty close – more so than for Merb in my opinion. That said it does seem to be less the subject of blog posts than Merb (although I think that will all change in the coming months). Its got a book (albeit an incomplete one), a ton of well written examples of ranging in size from hello world to a social networking site and a great set of blog posts by Pistos.

All my gushing aside, I did run into a bit of trouble finding a good end-to-end deployment solution. This wasn’t a bad thing though – it forced me to get to know Rack a little better and look into process monitoring solutions. In the coming days (ok maybe weeks…) I’ll be posting my solution (which involves a couple of mongrels under god’s watchful eye) – its not rocket science by any stretch of the imagination but I did run into a couple of snags…

In Short…

To sum it all up for those of you who’d rather read the back of the envelope (thats me!) here is how I’d characterize each of these Ruby web frameworks:

  • Merb
    • Skip it and check out Ramaze instead
      • Merb will likely give you a leg up on Rails 3 but Ramaze will serve you better in the “alternative to Rails” context.
  • Sinatra
    • Great place to start if you’re new to web development
      • The README page is close to a one stop shop for everything you need to get up and singing
    • The handy multi-tool you need to get small jobs done quickly
  • Ramaze
    • The fine wine of Ruby web frameworks
      • It requires a bit more work but its very rewarding
    • Fluff-less
pixelstats trackingpixel
  • This is an interesting article although I don't know what you mean by 'online presences'.

    I thought by definition everything on the web has an online presence. Can you point me to a definition of 'online presence' in the way that you mean it here?

    Thanks
  • You're right - "online presence" is a very general term and I should have been more specific.

    What I was trying to describe was a simple website that presented an individual or business to the general public. I was not trying to describe online services such as those provided by Google or Github.
  • cored
    Good work with the article.
    I liked the way you give details about all this frameworks, but, can you give some reasons why somebody should skip Merb ?

    It's just because of the merge or do you have other reasons around that suggestion.
  • Thanks - Yes, the merge is the reason I suggest skipping Merb.

    In general I don't think time spent on Merb is wasted in that its a well done framework and it should at least give you a leg up on Rails 3 - but if you're looking for an alternative to Rails then I think spending time with Ramaze will serve you better.

    I'll update the entry to be clearer.
  • MistaHugh
    Even if I have trouble understanding a large percentage of the above writing, I still somehow thoroughly enjoyed reading it. Well done mate.
  • kez
    I'm also in agreeance.

    Just wanted to point out a slight typo in the middle paragraph of the Ramaze section - "Ramaz's"

    Cheers.
  • Thanks kez, I've corrected the typo.
  • Nice, brief overview of the three. Thanks for sharing your thoughts on them, and thanks for the positive mention of Ramaze, as well as the linkage. :)
blog comments powered by Disqus