September 22 2009

the first mobile Ruby

Our open source framework Rhodes contains the first implementation of Ruby for every major smartphone operating system: iPhone, Android, BlackBerry, Windows Mobile and Symbian. The primary benefits of the Rhodes framework are: the productivity and portability enabled by writing interfaces in HTML once (and compiling to native smartphone apps), access to device capabilities from a common library used on all smartphone devices and the ability to easily incorporate synchronized data for offline use.

But that said, we may have been underestimating the benefits that Ruby has for mobile development irrespective of the Rhodes framework which uses it. Ruby has compelling advantages for building smartphone apps that are worth describing in their own right:

  • scripting language. Everything from implied (duck) typing to easier creation of classes and functions to built in support for regular expressions result in much higher productivity
  • economy of expression. Ruby apps are often less than a third of the size of equivalent Java apps. This helps to make apps easier to maintain even after the initial productivity boost. We’ve found that the best mobile apps are small apps. HTML for UIs helps enormously to minimize code size. Ruby for controllers helps make sure that economy gain isn’t lost. The result is that Rhodes apps are usually less than 20% of the size of underlying SDK apps (e.g. Objective-C apps)
  • rich ecosystem. On GitHub, RubyForge and elsewhere Ruby gems and plugins abound. The success of Ruby on Rails has spurred a huge industry of addon capabilities that can be leveraged by mobile developers using Rhodes as well
  • pure object-oriented design. This makes it easy to build both an overall framework on (such as Rhodes or Rails), and also develop libraries for


If you’re not using Ruby today for web development, we strongly urge you to consider it (our RhoSync server is a Ruby on Rails app of course). Ruby on Rails can be used productively by relative Ruby novices (although being a programmer comfortable with the Model View Controller pattern certainly helps conceptually). If you’re not using Ruby for mobile development, we’d encourage you to consider the Rhodes framework. If you’re uncertain about your ability to do so without Ruby skills, we’d encourage you to try it regardless. As an MVC framework most of your UI will be done in the views as HTML templates anyway. Our RhoGen app generator creates the Ruby code for the controller, which does basic Create, Read, Update and Delete of synchronized data on your phone right out of the box. But you can also use this controller code to learn Ruby, modifying and extending the code slightly as time goes on.

Since we first shipped Rhodes last December, we’ve been happy to see other mobile Ruby implementations emerge. Pragmaticomm has developed a mobile Ruby for Symbian. We’d like to eventually merge our Ruby with theirs. Charles Nutter has an Android version of JRuby well on its way to completion. Once it is complete we’ll take a look at the size and perhaps adopt it. I also talked with Matz at this year’s EuRuKo about factoring out our mobile Ruby implementations and getting it merged with general 1.9 development (this would save us ongoing work of course).

Otherwise today Rhodes is the only way to do Ruby development on the leading US smartphone operating systems: iPhone, BlackBerry, Windows Mobile. But because of the advantages of Ruby listed above, I have no doubt that will change and all smartphone operating systems vendors will eventually ship their own mobile Ruby implementations. That’s OK as we really are the “open mobile framework” company not the “mobile Ruby” company. But helping you developers build apps faster by providing you that mobile Ruby implementation now instead of years into the future is an exciting privilege.