Blogo – How One Team Built a Commercial Mac OS X App with Ruby
Blogo is a Mac / OS X blogging client developed by Brainjuice - the business name of Benjamin Jackson and Ivan Neto, Rio based Ruby developers and Web designers - and born out of their frustration with existing commercial blog editors.
Brainjuice believe Blogo is the first commercial OS X Ruby app (though the first cross-platform one goes to someone else - see the footer of this post for info!). Rather than use Objective C (which they found to be a serious time hurdle), they tried out RubyCocoa and discovered the beauties of Cocoa (other than the rather gangly method names!) in that way instead (along with MacRuby). After a lot of work and more than a few conversations with Laurent Sansonetti [of MacRuby fame], they were able to get Blogo to release.
I asked Ben some questions about the pains, pleasures, and processes behind releasing a desktop Ruby app for Mac OS X:
Ruby Inside: Blogo is an OS X only application. Was writing for OS X your initial idea or did you look at alternatives (such as JRuby and Monkeybars)?
Benjamin Jackson: Not a chance. We don't settle for non-native interfaces. We hate AIR. We use Safari. When you take the native interface away from the user, it just feels wrong. Controls don't respond the way you know they should. Tab ordering NEVER works correctly. Drag and drop becomes drag and pray.
Coca Cola adapts their recipes for every single country in the world. If you care about a platform's users enough to dedicate time which could be spent making your product better to make a version of your software for them, it should imply that you care enough to deliver something which does more than just compile and run on their system.
What process did you go through to package Blogo for distribution? Were there any surprises or snags along the way?
Hell! I learned more about ruby's internals than I ever wanted to know. Patched Jonathan Paisley's excellent standaloneify script to work with our build environment. Compiled every single C extension for both PPC and Intel. Hacked the main ruby file to chop the load path down and avoid crashes due to conflicts with non-standard ruby installations (hello, readers). Rewrote the entire remote IO to use native Cocoa functions with asynchronous callbacks rather than running their much more convenient ruby equivalents. Swapped out all gems which dealt with remote data for Cocoa equivalents, or rolled our own. Removed all ruby threads and used NSThreads.
MacRuby will be better. *knocks on wood*
I noticed that Blogo was quite a large install (28MB download) for what it is. Do you think large file sizes will be off putting to users and that progress needs to be made in this area regarding Ruby app packaging, or is it a non-issue from your point of view?
We build for Tiger and Leopard. We will not be doing this for long. The limitations imposed by a dual build include having to embed your entire ruby distribution as well as all gems and frameworks. Growl+Installer is one of the heavier ones. GData, HMBlkAppKit, Sparkle and rb-appscript are other disk hogs.
What advice would you give for someone looking to build Mac apps in Ruby?
Study Cocoa. Read the conceptual documentation and the HIG (Human Interface Guidelines). Learn the APIs, because you're going to have to know what that slidey thing is called before you subclass it. Cocoa forces you to wrap your brain around a lot of patterns that don't get much air time in other frameworks. Delegates and bindings don't just save programmer time, they change the way you think about your code.
Use MacRuby. It's stable and Leopard-only. Forget Tiger.
Join the macruby-devel mailing list. Give the devs feedback. They're nice guys. They'll help you.
Look into Hot Cocoa. Rich Kilmer has done a great job on this, and it looks like it will be one of the nicer bits of MacRuby. Writing little domain-specific-languages like this is generally against the
sayExactlyWhatYouMeanToSay: andMore:syntax of Cocoa, but at the end of the day it's Ruby, dammit. Terse and clean makes Matz smile.
What next for you and Blogo? Do you plan to develop any further desktop applications using Ruby?
We have many plans. Some of them will likely involve MacRuby to one degree or another. Not having to compile is incredibly convenient on many levels. Some may involve Rhodes. But I don't ever see us writing an application without a single line of Objective-C. And I don't want to. It's beautiful in a strange, Lisp-y way, and reads much better than Lisp IMHO. Ruby is one more tool for us to get the job done quickly.
Note: Blogo is far from the only commercial Ruby desktop app - David Koontz, James Britt, and Logan Barnett's JotBot (an innovative time tracking app) is also a fine example as the first commercial cross-platform desktop Ruby app (built around Monkeybars). David even posted a good wrap up of how it came together recently.