
An Intro to Backbone.js: Part 2 - Controllers and Views - n_time
http://liquidmedia.ca/blog/2011/01/an-intro-to-backbone-js-part-2-controllers-and-views/
======
Tichy
I haven't looked into it in detail, but I am interested in an opinion. Could
Backbone.js possibly be overkill? I think on the server side that kind of
framework evolved to deal with server side specific issues. Should it just be
ported back to the client?

I have only started to develop something with sammy.js (also a JS framework
with routing and so on), and it already seems to me it might not always be a
good match. For example sometimes I only want to render a part of the
screen/web site again, not the whole thing. What then should be my route? I
guess it could work like the AJAX updates in Rails, but still, I wonder if it
is too complicated to go through all the routing and so on.

Why not just bind events to actions directly, and update at will from inside
the event handler?

What advantage do backbone.js models provide over javascript objects?

~~~
jrockway
_What advantage do backbone.js models provide over javascript objects?_

Event binding, refreshing to the server, dirty tracking, etc.

Basically, the pattern is: get JSON doc from the server, inflate it into a
model, hook in a view, and then as you mutate the model, in code or the UI,
the UI and server are updated. Can you write this yourself? Of course. Do you
want to? That's up to you.

Personally, I find Backbone's sugar most useful for views. You make a DOM
element that represents your thing, and then you program in terms of that
thing, and the UI "just works". It's wonderful.

Anyway, Backbone is absolutely not overkill. It's just what many apps need,
and you can use as much of it as you want.

(I should point out that I don't do server-side HTML anymore. My web apps are
JSON/REST endpoints that also serve a few pieces of static HTML, JS, and CSS.
Everything UI-related is done on the client side. Backbone makes this
amazingly easy.)

~~~
steveklabnik
This is also a particularly good pattern for mobile applications as well. Your
app serves a tiny page, and then lets it load the data basically in the
background. Combine with some localstorage to show the information from the
last time they were there right away, and you can make apps that feel
significantly more responsive than they were before.

------
grandalf
this seems relevant:

<http://jobs.37signals.com/jobs/8105>

~~~
grandalf
Not sure why this was modded down. If someone wants to work with backbone.js,
why not get paid to do so.

------
chrisfarms
thanks for these... enjoying your Intro.

