New developments in web app frameworks-Backbone.js

Okay, this is just a summary of a few things I’ve been made aware of recently that seem cool and useful. It’s wonderful to see how people are sorting out the most useful things these days, and, often, making them popular. Clearly presented, well-documented, well-designed things, that take off because of that. How nice.


Backbone is a web app framework for the Javascript (server-) side of your application. Let’s say you use an MVC framework for your server side–something in PHP, or Ruby, or Python. Well, what do you do on the client side?

There’s jQuery, which is beautiful, but it’s more a system for accessing the DOM, but is not inherently designed to talk with the server side, or manage data. This was one of the things I kept running up against a few months ago–for any variety of reasons, I need the server side (PHP in that case) to talk to the client side (jQuery). How, exactly, should I do this? It felt sloppy and home-grown.

Furthermore, it felt somehow inelegant to relate the data I wanted to store, directly with a series of selectors in the HTML. Yes, it did seem that that was how people did it; but it seemed counter-intuitive to my training.

This would be very useful if you want control over your code, but you want to do things elegantly. Or, because you’re trying to do a lot on the client side, like for example, GMail.

Here’s a great article about it: Building a single page app with Backbone.js, underscore.js and jQuery, by Henrik Joreteg.

He also mentions a Javascript, client-side templating engine, for use with jQuery, called ICanHasJS. This goes beyond what I’d thought about all this, but it’s pretty cool. Let’s say you have a client-side app, and you know you want to populate it with a bunch of data–but not as you build the page (server-side), but later–why not use placeholders to populate it, like you would with a server-side thing, such as Smarty? Smart.

Backbone also provides a RESTful API to allow a standardized way for your server and client sides to talk. That makes a lot more sense.






Posted in