Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Ramaze: Another Light Ruby Web Framework, But With MVC!

By Peter Cooper / November 23, 2007

Notrails
Ramaze is a simple, light weight (in a good way!), modular Web framework developed in Ruby. Like Rails, and unlike some of its newer competitors, such as Sinatra, Ramaze sticks to the MVC (Model, View, Controller) paradigm, making it more like a lighter, more modular Merb-alike. Ramaze is already a year old, and one thing that the official Ramaze Web site does right is provide lots of example code and documentation. The framework has also seen four releases in the last six months, a sure sign that someone cares about it.

Inspired by Ruby Inside's recent post, "Reprise: A Ruby-Powered Blogging App in 100 Lines Including Templates," Aman Gupta, one of the developers of Ramaze, has converted the code from a Sinatra-based non-MVC format over to the Ramaze equivalent, so you can get a direct comparison of the two different approaches by reading two sets of code for the same application.

Comments

  1. psi0nik says:

    I think it should be pointed out that, while not enforcing MVC, Sinatra in no way prohibits you from writing an MVC-style app.

    It's easy to build discrete model classes, database-backed or otherwise, and templates in external files are supported. at it's core, it seems that most of the Sinatra DSL is essentially the (C)ontroller portion of MVC, and basically leaves it up to the developer to decide how to implement the remainder of the stack.

  2. cooler says:

    nice!
    sometimes I need "one page one application just like Ramaze's hello world exmple"

  3. Riku Räisänen says:

    Ramaze doesn't enforce MVC style in any way. When there's zero configuration, Ramaze acts as a VC. M can be easily plugged in with the ORM of your choice, of course.

    Ramaze could also play the role of a simple file server(which would be pointless) with it's easily customizable Dispatchers. Customization is the thing I love about Ramaze - the code is really easy to understand and robust spec-tests tell me if I'm doing something wrong. Not to mention close to 100% covering documentation.

    I've gone throught the route of PHP(spahghetti code), Rails, Nitro/Og and now Ramaze. Ramaze feels most comfy, thanks to: the freedom of choice(a hackers dream), zero configuration, simplicity and the most helpful community.

    We have multiple Ramaze applications/portals/websites running live and I think the numbers will only grow. :)

  4. Chad Fowler says:

    Reading this post and then the linked code, it looks like your definition of "MVC" requires separate classes for models, controllers, and (sorta) views.

    In reality, Sinatra and Ramaze are both MVC web frameworks (in as much as any modern web framework claiming to be an MVC framework really follows MVC). I don't see any significant architectural/conceptual difference between the two frameworks.

  5. Peter Cooper says:

    Almost /anything/ can be considered to be MVC depending on the angle you look at it. The truth is, they are pretty similar, but one project has used the term MVC and the other hasn't. The term MVC is reasonably bogus anyway as even systems that reinforce the concept can easily be used without it at all, such as Rails. It's really down to whether a system makes it easy to separate the concerns or not, and in this respect Ramaze seems more focused towards that than Sinatra.

  6. John Philip Green says:

    I wish Sinatra had a site with docs like Ramaze.

    Actually, by way of framework sites, Merbivore's got them all beat on design right now. Blake should talk to whoever did that!

  7. Peter Cooper says:

    As an aside, I want to do a big post about Merb soon. If anyone has any good links, tutorials they've written, stuff like that, do get in touch (or even leave them here in comments).

  8. Blake Mizerany says:

    Sinatra is only six weeks old; it's fresh, very new, and has seen more press and more downloads than I had ever anticipated. I'm putting as much free time into it as I can.

    The new site, and docs are all coming with the next release. And yes, they will show you how to move to MVC when needed because Sinatra doesn't assume you should start with it. I strongly believe in backing into a pattern. See Principles, Patterns, and Practices - Chapter 24 - by Robert Martin

    If you want to see a great example of how to do so with the current release, check out:

    http://blog.zerosum.org/2007/11/5/build-a-simple-pastie-clone-with-sinatra-datamapper-in-15-minutes

    Until then...

    get '/your_favorite_framework'
    'and keep cranking out killer apps'
    end

    -Blake

  9. Ezra says:

    Hey Peter-

    Here are some good links for merb stuff:

    http://pastie.caboo.se/pastes/121330

    But I have to say that I really like both ramaze and sinatra. The ability to make small webapps all in one file is pretty sweet and it's something merb doesn't do.

  10. Ben says:

    Ezra, Merb lacks a few things - and it hurts Merb badly (i and several people I know would use Merb except...) a) no community forums.... where should I share my merb knowledge? the irc channel? no thanks. too disposable... A community forums could do wonders for the progression of Merb. b) Sample apps that actually work.

  11. Curious User says:

    All due respect to the developers of these frameworks, but who cares? Why do we need 5 different versions of "Rails-lite"? Honestly, wouldn't these guys be better off joining forces with Ezra on Merb or something?

  12. James says:

    Two points.

    "Ramaze sticks to the MVC (Model, View, Controller) paradigm, ..."

    Not really. Ramaze makes it easy to build MVC Web apps, but also makes it easy to roll out single-file, PHP/ASP-like sites as well (a feature also found in Nitro, from which much of Ramaze seems drawn.)

    To "Curious User": Ruby does not have five versions of "Rails lite." The various Ruby Web frameworks (some of which predate Rails) are each interesting approaches to Web development. Each is opinionated software, and the diversity of opinions is refreshing.

Other Posts to Enjoy

Twitter Mentions