TurboGears vs. Ruby on Rails
Posted by Curt Hibbs Thu, 20 Jan 2005 08:00:00 GMT
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.