Building Next Generation Web Apps with Rails and SproutCore

Mike Subelsky (OtherInbox)
Tutorial
Location: Pavilion 2 - 3
Average rating: ***..
(3.21, 34 ratings)

Future web apps will be faster, more fluid, and more feature-rich. They’ll be more like desktop apps, and will need to be built in a way that gives them maximum agency without needing to consult a server. They’ll be built using web native technologies like HTML, JavaScript, and CSS (with a little Flash thrown in).

Conventional Rails techniques (ERB and RJS) can get you up and running with a prototype, but because they were not designed like a desktop framework would be, it’s very difficult to create a full-fledged client-side app running in the browser. You need to write too much glue code, the kind of code that’s very error-prone and hard to test. Too much intelligence still resides on the server.

SproutCore is a new framework inspired by Cocoa to help you build “3F” desktop web applications, and is a natural compliment to a Rails app. Using SproutCore, you can develop client and server as separate applications, each optimized for their roles. The user downloads a couple of cached, compressed, minified assets: JS, HTML, CSS, and a sprited PNG file, once, then simply talks to the Rails app using lightweight REST and JSON APIs.

Developers need a framework like SproutCore because, as its creator Charles Jolley wrote, “…writing an app in Javascript on the web is akin to writing C on the desktop: it is just one level above the ‘bare metal’. When you start building full client apps in the browser, even simple things like displaying a list of items efficiently, can quickly consume endless hours of mind-numbing work to get it right.” Like Rails, it aims to do 80% of the hard work, so the developer can focus on the 20% unique to his or her application.

Writing a SproutCore app feels much like writing a Rails server application, because it borrows several Rails conventions. Developing client apps in this way often feels like a matter of configuring and connecting software components, and not trying to create a complicated, unwieldy code edifice. SproutCore even uses ERB or Haml templates to generate much of the JavaScript and HTML you’d otherwise have to write by hand.

In this tutorial, I will guide students through the construction of a complete SproutCore client that talks to a Rails server app. Students will implement key SproutCore concepts like Key-Value Observation and Bindings, as will learn how to efficiently develop desktop applications. The students will leave the tutorial with a better understanding of what the future holds for web application development, and with the basic tools needed to get started on their own projects.

Speaker interview with Mike Subelsky

Photo of Mike Subelsky

Mike Subelsky

OtherInbox

Co-founder and lead hacker of OtherInbox. I’m a hacker, Ruby on Rails developer, SproutCore enthusiast, and improv theater director based in Baltimore, Maryland.

Comments on this page are now closed.

Comments

Picture of Mark J. Levitt
Mark J. Levitt
05/08/2009 4:39pm PDT

@Rasmus, looks like the presentation was posted above since you made your comment.

Nataliya Shurupova
05/05/2009 1:48pm PDT

Thanks for the great tutorial. Liked developing the application during the lecture, while steps were well explained and questions were answered on a fly. Looking forward to more presentation!

Jonathan Hicks
05/05/2009 11:32am PDT

It was a very interesting talk and very well put together. It seems, though, that you have to have some in depth information about sproutcore to change any defaults. Also, with the 1.0 coming out soon, it sounds like all of this is going to change soon.

Rasmus Brock Graver
05/05/2009 10:02am PDT

Great presentation. I think Sproutcore looks very promising. Could you post a link to the presentation and the solution text file we used please?

Francois Harbec
05/04/2009 11:54pm PDT

thanks for the informative session. Lack of power was a bit of an issue but I still manage to get enough far enough along to get the general concepts down.

Picture of Jae Hess
Jae Hess
05/04/2009 4:48pm PDT

Thought it was great! SproutCore seems to be a better fit in most cases as appose to the Flex SDK. Wish I had power the whole time.

News and Coverage
co-presented by Ruby Central, Inc. O'Reilly
  • Engine Yard
  • Heroku
  • Sun Microsystems
  • Blue Box Group
  • New Relic

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at RailsConf, contact Yvonne Romaine at yromaine@oreilly.com.

Download the RailsConf Sponsor/Exhibitor Prospectus

Media Partner Opportunities

Download the Media & Promotional Partner Brochure (PDF) for information on trade opportunities with O'Reilly conferences or contact mediapartners@ oreilly.com

Program Ideas

Post your suggestions for speakers, topics, and activities on the RailsConf wiki or send an email to rails-idea@oreilly.com.

Press and Media

For media-related inquiries, contact Maureen Jennings at maureen@oreilly.com.

Contact Us

View a complete list of RailsConf 2009 contacts.