SproutCore is the second framework I’ve used in my project to implement a trivial time tracking application in multiple client-side/rich frameworks. SproutCore, the framework behind Apple’s MobileMe, is one of the heavyweight contenders in the desktop-like web application arena. Originally released last year in version 0.9.x form, it has undergone major changes over the past year+ to the currently near-release 1.0 version. Thankfully my experience with SproutCore started as it was becoming more stable towards the 1.0 release, although the documentation still hadn’t all caught up to the 1.0 changes (but has since been massively updated and is in good shape now).

SproutCore is a Cocoa-inspired framework, but is implemented in JavaScript so it makes use of some of the good aspects of the language. JavaScript as the language choice comes in contrast to RestfulX which uses ActionScript 3, and Cappuccino which uses (and created) Objective-J.

Since I’ve already looked at RestfulX, it’s interesting to note some similarities in the platforms. Both have:

  • Ruby tools for code generation and application compiling/building
  • Bindings to wire together the various components of applications
  • Fixtures to let you develop your app prior to switching over to using a real back end server

A big difference comes in SproutCore’s model layer and how it interacts with the back end. SproutCore provides a higher level abstraction that manages when objects are changed and need to be updated, and when they’re busy and shouldn’t be modified, for instance. This is handled via the SC.Store, which your controllers interact with directly. Underneath that is an SC.DataSource, which you have to implement. I can understand the reasoning for not having a one-size-fits-all data source, but I was surprised no one else had crafted one up for Rails yet. Implementing my data source ended up taking longer than the rest of the app, but it was a good exercise in getting to know the framework better. I’ve included a generic data source in this implementation that can interact with a stock Rails server (no tweaks to make the JSON SproutCore-friendly), and may follow up with a post on that.

  • Other miscellaneous notes on my experience with SproutCore:
  • Attractive controls by default
  • No date selection field in standard widgets (although this appears to be part of the new SproutCore-UI project)
  • Write-save-refresh cycles are somewhat slow, but speed up substantially with Ruby 1.9 vs 1.8

Finally, here is the code:

Blog Logo

Bruz Marzolf




Back to Overview