Right up to my first topic: Sproutcore.

I’ve held a workshop about it in the last two weekends, where I demonstrated how to build a basic groupchat application. Unfortunately, the 8h I allocated for it weren’t enough (but it was close) due to some typical JavaScript issues, namely that it doesn’t do any name verification at all.

You can get my demo application from github.

But, back on topic. Sproutcore is a JavaScript framework for developing modern browser-side web applications. This means that only a single URL is fetched from the server, the rest of the page is run locally. Of course, the application can do AJAX requests back to the server, but the user never has to wait for it after the initial load.

This totally changes the concepts of web pages, and leads to a model that’s very close to desktop development.

So far, this is actually nothing unusual. There are many other frameworks like this, like GWT and Cappucino. The special thing about Sproutcore is that it’s based on concepts known from Cocoa, like Key-Value Observing, Key-Value Coding and Binding. These allow creating a very dynamic application without having to write any code to update the content after the initial setup. For example, if the storage layer receives new data from the server, it can be inserted into the data store, which automatically updates the user interface, while still adhering to the MVC concept.

In my demo application for the workshop, for the communication with the server I chose XMPP as the protocol. The reason for this is that via BOSH the whole server-side infrastructure was already in place, and there’s a nice JavaScript-library available for it, strophe.js. Besides, it’s a very popular standard protocol, and I’m a big fan of it.

I used the storage layer I mentioned earlier for communicating with the server. Creating a message locally means sending it to the server, new messages that are received are created from the storage layer. This allows a clear separation between network protocol and application logic. Due to the dynamic nature of Sproutcore, this works perfectly.

I’ll probably followup with more specific Sproutcore-related things later, since I’m using it for multiple rather large projects. There’s a lot to discover and learn.

« »