Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You're quite correct -- any "trivial" tutorial example will always be better off written without an external dependency. But we're not using libraries to help make writing 10 lines of jQuery easier -- we're using libraries to help write JavaScript applications. The idea is that Backbone will end up helping your write far fewer lines of JS in your real-world app, because instead of having to manually:

    updateTitle: function(id, title) {
      var doc = window.myApp.documents[id];
      $('.document-' + id + ' .title').text(title);
      if (localStorageAdapter.get(".doc-" + id)) {
        localStorageAdapter.set("document", ".doc-" + id, "title", title); 
      }
      var details = $(".document- " + id + " .details");
      if (details.length) {
        details.find(".doc-title").text(title);
      }
      ... and so on, and so forth ...
    }
You have a convenient way to manipulate your data and have your UI react:

    Documents.get(id).set({title: "Don Quixote"});
... at least, that's the hope.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: