TurboGears: First Impressions

TurboGears is my first choice for a new webapp platform, as both it and Django seem to have a reasonable following. TurboGears seems to suit my ethos for a webapp platform more than Django for a variety of not particularly conscious reasons. It just feels more like what I want. I’ve started to play with it, and here are my first impressions.

The Good

After some initial hiccups (discussed below), installing the codebase is pretty easy. Getting a demo app running is quite simple, via tg-admin quickstart, though I couldn’t find the ‘login’ link at first, because it was aaaaalllll the way over on the top right, and quite small. The graphics are quite shiny, and it’s a good ad for the product. It made me feel good about my choice, so far.

The tg-admin toolbox is awesome. The CatWalk tool enables you to browse the database via the web, updating data if necessary. This is great when you’re prototyping your app.

The web based, AJAX enabled schema browser/editor ModelDesigner is very, very handy. Again, it helps you to rapidly prototype your app by interactively tweaking your schema. Power users will probably just do this via the code, but for a novice like me, this is a great way to learn how the model stuff works. This is a big advantage over Zope 3, which seems to have a very steep learning curve and few tools to help you learn the basics.

Similarly, the Widget Browser lets you take a peek at the widgets that are available and how they work. This is a great way to learn what UI features you can use out of the box, and the range of widgets is impressive. There are AJAXified widgets that look quite good. To get similar stuff with Zope 2 you need Archetypes, which does some magical stuff under the covers that you may not want, and it doesn’t seem to be available in Zope 3 yet, and has many deprecation warnings.

TurboGears is also quite lightweight, which makes it faster than Zope by a long way. But then, Zope has a lot of extra stuff in there designed to give you a lot of functionality for free.

The Bad

It’s a little early to say that anything is really bad, as such. It appears the TurboGears ethos is to do-it-yourself, rather than have everyone adhere to a single, common thing. This is not necessarily a bad thing, and is a similar criticism I have for Zope. It may mean that you need to write a lot of boilerplate style code, rather than simply stand on the shoulders of other TurboGears coders. This will probably change as TurboGears gains wider acceptance and more people write stuff using it.

You don’t get a whole bunch of features for free with your classes. In terms of Zope equivalents, there’s no Catalog, but then, all your objects exist in a database accessible via an ORM, which implements search functions, so this is kinda moot. There’s no base or mixin class that implements Dublin Core attributes, which is a shame, but again, this may not suit all models.

You can’t simply add new subclasses of Objects into your app via the web the way Zope 2 does, via ZClasses and through-the-web class definitions. You have to define objects via classes and your database model. To be honest, I actually think this is a feature, not a bug. It removes a lot of the overhead and weirdness that some of the Zope 2 magic creates.

It looks like traversal, in the way that Zope 2 gives you a hierarchical inheritance in your web structure, isn’t there. I’m not sure if this will be a problem or not.

Not having a Plone based layout designed for free means I’ll need to do it all myself from scratch. Again, this may actually be a feature, since the Plone stuff has loads of guff in there to cater for a variety of people’s needs, which don’t necessarily match 100% with mine.

The Ugly

Install is relatively easy, though the Ubuntu version I’m on installs a Python 2.4 compiled version, while I actually run Python 2.5 for most things. Zope also needed Python 2.4, I guess because that’s deemed ‘stable’ in the distro. This breaks the apt-get installed TurboGears. If you try to run tg-admin (the TurboGears admin program), you get a weird “int out of range” error. The fix: Don’t use the apt-get version of TurboGears. apt-get remove the APT installed TurboGears and download the tgsetup.py file from the TurboGears website, and run that with your Python 2.5.

In Sum

My initial impressions lead me to want to do more with TurboGears and really take it for a test drive. There more I play with it, the more I think Zope 2 has become unwieldy bargeware that gets in my way more often than it helps me. It could just be that Zope 2 was ultimately a poor choice for what I wanted to do, and I shouldn’t blame the tool for that.

I certainly haven’t been turned off TurboGears at first usage, which bodes well. I’m hoping that as I learn more about it, the reasons for things being done a certain way become more apparent. I haven’t had that ‘Aha!’ moment, so I don’t really grok TurboGears yet. But, I’m hoping that I will.

So that’s a good thing.

Bookmark the permalink.

Comments are closed.