« OpenGL explorations | Main | OpenGL is turtles all the way down »
February 17, 2005
Shifting gears to Ruby
I'm giving a talk on RubyCocoa to the Seattle Ruby user's group next week. I was the second member of the group, which was founded by Ryan Davis, a software developer I met while working at Amazon, who now works for the Omni Group.
If you haven't heard of Ruby before, it's an OO scripting language that takes inspiration from Perl, Python and Smalltalk, and is hugely popular in Japan. I very much prefer it to Perl, it was designed for OO development from the start and isn't as idiosyncratic as Perl and much more readable to boot.
RubyCocoa is a set of Ruby bindings for OS X's Cocoa and AppleScript frameworks, it lets you write OS X apps in ruby. Since OS X implements the V in MVC for you, apps need only implement a model and a controller. A stock install of OS X lets developers write Cocoa apps in Objective-C and Java, and while these are fine languages for developing applications, they can get in the way when you're creating prototypes or trying to do rapid development.
Enter RubyCocoa, which lets you write models 10x faster than Java or Objective-C. It is an interpreted language, so you don't have to wait for builds, and Ruby itself is more extensible than Java or Objective-C, which lets you focus on sketching out features and working on your prototypes. I think RubyCocoa is a strong technology for prototyping OS X apps, so I'm going to talk about its pros and cons to the group.
The format of my talk will be fun, since it's a live hacking talk. I've done this a couple times for past meetings, and it was always well-received. Basically, I do an interactive session where I ask people for requirements for an application, and then I develop it in front of the group. It makes for a fun environment, since there are always a couple good-natured hecklers who will ask why I'm adding arguments to a method, or refactoring a class, etc, etc. It's also a good way to instruct the novice developers in the audience how to reliably build apps from the ground-up.
The RubyCocoa app I'll be writing for the group is going to be some sort of content browser that makes soap calls to an online resource, I'm not sure who yet. Suggestions have included Amazon and Google, and I bet there are a couple others we could try. I'll be spending some time over the next couple days making sure my RubyCocoa install is up to date, that all the tools and debuggers are working, and do a little refresher work to make sure I remember how to glue all the pieces together. I'm going to write the core controller callbacks and instantiate a blank window and canvas before the presentation, but that's it, the adding of UI elements and connecting them to the model will all be done live. It should be a lot of fun.
I'm planning to do a future talk on using Apple's Accelerate framework from Ruby. Accelerate framework contains Altivec-accelerated routines for math operations, matrix calculations, equation solving, and different types of FFTs. I'm planning to write a ruby extension that wraps Accelerate framework, my calculations show that Ruby plus wrapped Altivec will be much faster than straight C code using FFT-W. The benefit of having fast FFTs in ruby is that it's much easier to shove data around and transform it with ruby than Obj-C or Java, so it will make it easier to prototype DSP algorithms and enable hard-core number crunching with Ruby on OS X.
Posted by djb at February 17, 2005 03:38 PM