First thought about SproutCore

Posted: September 3, 2008 in Apple, IT/Dev

Here is what we can say about SproutCore after having read the first tutorials :

– there isn’t any tool (no source editor, nor Wysiwyg designer), but Interface Builder will perhaps be added later (after all GWT doesn’t provide any tool). Required directories and start files are created through command line, and it is based on Ruby scripting language.

– pages (views) are .rhtml (use the Erubis templating framework, based on Ruby). Here we define dynamic tags (labels, controls) through scriptlets .

– 1st main feature, bindings : we can bind the value of a label to an object property (defined on Javascript classes),or bind action controls (buttons, etc.) to action methods.
If such property value (of Controller or Model object) changes (through Firefox debugger) the values are updated in the browser view. The objects are alive on the client side, as in a runtime. The bindings allow low coupling (no code modification). The approach is very different from common tags systems (Struts, JSF…) : with these, once the HTML response is computed (tags are rendered) in the server side and that the response has been sent back to the client, the displayed values can’t change.

– 2nd main feature, observers (KVO : key value observer) : methods from the controller object can be triggered from properties values change events (allows such a notification center). This possibility was the key to strong features/code simplification (and code reduction) in Cocoa.

– the controller class is defined easily through an anonymous constructor (create method), where actions and notification (observers) methods are put (also properties, but they should be put instead in a Model class). The purpose it to develop quickly, with limiting the amount of required code and instanciating. The Javascript used is of high level (object oriented, with getters and setters) and tasks management APIs (timers, etc.) are provided (for example a private _timer property is included by default in controller objects, that allow easy management of basic cases).

There isn’t any transformation step as it is required with GWT (hurts the development cycle) and coding is the fastest possible, with the fewest required instructions. Server side services (webservices) calls are made using JSON-RPC (as with GWT or WebObjects Java Swing rich clients), that is RPC with a particular syntax (different from XML-RPC).
Then it is possible to call server code (backend) written with any technology : Java, PHP, etc.

We can however expect Apple’s YellowBox (full Cocoa with Objective-C) on Windows in the next (or two) year, as a response to Adobe AIR or Microsoft. Meanwhile some possibilities are available to add audio/video capabilities to SproutCore : new HTML5 video tags, QuickTime X that is part of Snow Leopard (could be a response to Adobe Flash, as QuickTime still allow to create full interactive applications in a single .mov container).
We are also expecting the merge with the Cappuccino framework, that provides a true Cocoa porting to javascript, and an extension (runtime) to javascript (Objective-J) – as Objective-C extended standard C -, that allows to call these objects (a live compilation step occurs, that produces basic javascript, but this happens transparently at runtime, contrary to GWT explicit compilation).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s