11.55, Thursday 24 Aug 2006

Mac OS X 10.5 Leopard is going to have Ruby on Rails pre-installed. It's also going to have Python and Ruby bindings to Cocoa built in (I've been writing full-blown Mac apps recently using PyObjC, giving me the development speed of Python (including the console interface) plus the ability to dive into Objective-C when I need to, for example, muck around with USB). And I also read that tixe, the framework that gives your application programmatic access to what's happening on a webpage, has been rolled into the official Apple browser.

With the right helper libraries, this adds up to Mac apps that are as easy to create and iterate as web apps.

Okay, so it goes like this: You prototype your application by making a Ruby on Rails app, running it on the built-in webserver (Mongrel comes with 10.5 too). After you get it running in a regular browser, you create a shell Mac application: this is just a minimal web browser instance in a window, pre-configured to visit your local Rails app. With a couple of lines of code you set it up to start and quit the webserver when you open and close the app.

Using Interface Builder, you create new elements in the Mac app (buttons, drop-downs, menus and so on). There's a special Rails controller class for dealing with these, so you make that and wire the native UI elements up to existing actions. You don't even need to do http requests because tixe lets you treat the UI elements on the webpage just like the native UI ones. And now the native app is working, you ditch the equivalent actions inside the web view and just use that for displaying data. If you need to tap into system level services on the Mac (like IM, scripting other apps, or whatever), you can.

Ta-da, you've got a Mac app. Sure it's a bit kludgy and not the fastest thing in the world--but it's network native, it's easily deployed, and it's very fast to build. If somebody writes the correct tutorials - and knowing the Rails crowd, somebody will - this substantially lowers to bar to prototyping applications on the Mac.