Skip to content

SproutCore models

by Topper on July 1st, 2008

http://github.com/sproutit/sproutcore/wikis/sproutcore-s-modern-model-layer
http://github.com/sproutit/sproutcore/wikis/sproutcore-s-modern-model-layer-part-2
http://github.com/sproutit/sproutcore/wikis/sproutcore-s-modern-model-layer-part-3

Those links (if you haven't checked 'em out) provide some nice insight into how the SproutCore team is thinking about javascript models. It's an interesting pattern of separation.

Basically:

In a model you use MyModel.get('blah') and MyModel.set('blah') and then (it uses ruby helpers) in a view you do something like this:

RUBY:
  1. <%= progress_view :progress_bar_id,
  2.          :minimum => 0,
  3.          :maximum => 100,
  4.          :indeterminate => true | false,
  5.          :value => 50,
  6.          :bind => { :value => 'MyModel.blah' } %>

where bind is telling it to update the view everytime the value 'blah' changes.

It seems like a relatively simple pattern (at least for simple updates). I'm not totally sold on SproutCore itself (and it's defacto lock-in to certain UI) but all-in-all those guys are real smart and are paving the way for real client-side javascript frameworks (not just these libraries that we have now).

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS