TurboGears vs. Ruby on Rails

I just read this nice little comparison of Python’s TurboGears with Ruby on Rails. I think its a fairly balanced comparison. The author prefers TurboGears, but if you value productivity through less code, then Rails still comes out on top:

The immediate first impression is that TurboGears is more verbose(or explicit, if you like) than Rails. For example:

RoR:


        class NewsController
            @articles = Article.find_all end
        end

TG:


        import cherrypy
        import turbogears
        from turbogears import controllers
        import model

        class News(controllers.Controller):
    @turbogears.expose(template="news.templates.index")
        def index(self, **kw):
            return dict(articles = model.Article.select())

One thing to note is how you have to tell TG what methods to expose to the web, which template to use, and what data goes in the template. In RoR this is decided for you; every method by default is exposed, any data in the method goes in the template, and the name of the template is the same as that of the method (in this case, index.rhtml). You can override these, but a lot of assumptions are made on your behalf.

3 responses to “TurboGears vs. Ruby on Rails

  1. To base it on something that small isn’t really a fair comparison. I am not siding with turbogears, since I like them both, but to base it on the fact that per class you will write a few more lines of code is a pretty weak argument.

  2. I’ll be the first to admit that there are many relevant reasons for making such choices. But, I beg to differ that lines of code is a weak argument. One thing that has been very consistent in past studies is that lines of code is strongly, inversely correlated with productivity.

    Of course, this applies much more in comparison with Java frameworks than with TurboGears (which is a pretty nice framework, itself).

  3. I guess I was a little vague in the working. What I meant was from such a small chunk of code it is hard to say that there will be that much more code, since the code above appears in the main controller of the site which is only one file, so at the end of a project it wouldn’t amount to much more.

    However, there is other parts of TurboGears that require even more code, respectively speaking, so there is truth to what you say, just not so with the example that was given.

    Just wanted to point it out. (I personally do lean more towards Rails)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s