Client Side MVC
Inspired by Cocoa
Common App Features for Free
Not trying to be Java, Ruby, Python, Obj-C
6. At the code level...
Example: A contact’s ﬁrst name
Most are simple values - numbers, strings, objects
Can be functions which dynamically “compute” value
Watch for property changes
Takes some action
Examples: Update view, send data to server
Two objects, “bound” together
When one changes, the other changes also
The contact ﬁrstName property is bound to the
textFieldView value property.
When the contact’s ﬁrstName is updated,
textFieldView’s value is updated automatically.
When textFieldView’s value changes, the
valueDidChange observer kicks in & updates the UI.
11. Glue Code Eliminated!
Controllers and views automatically stay in sync
with the model objects in your application!
there’s a small price to pay
13. Key Value Coding
Access properties with object.get(key)
Set properties with object.set(key, value);
This allows SproutCore to watch things change
Abbreviated as “KVC”
15. Computed Properties
Accessed like stored properties ( with get() )
Calls a function to compute the value
Declared with .property()
16. Key Value Observing
Allows Object A to observe changes to Object B
How binding is able to work
Abbreviated as KVO
Automatic for stored (non-computed) properties
Requires a little setup for computed properties...
17. Computed Property KVO
When declaring, list the attributes the computed
property relies on:
Generate skeletons for your application, models, views,
Helps you get started quickly
Gives you a standard place to put things
Generate your views with small, declarative helpers
Similar to Ruby on Rails view helpers
In fact, written in Ruby!
25. Development Server
Handles including JS ﬁles and view partials into your
HTML ﬁle - less work for you.
Allows change-and-refresh style development
Can proxy to external website backends for server
26. Build Tools
Packages all assets into single ﬁles - 1 HTML, 1 CSS, 1
Host your app on any server or CDN - just static ﬁles