An introduction into Backbone.js – a lightweight MVC framework. Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.
2. Who am I?
Jonathan Weiss
§ Peritor GmbH in Berlin
§ Webistrano / Capistrano
§ Ruby: SimplyStored, Happening
§ FreeBSD: Original Rubygems & Rails maintainer
§ The great fire of London
http://www.peritor.com
http://github.com/jweiss
@jweiss
2
9. Ajax
GET
PAGE
Logic
GET
Load
PAGE
Fragment
Fragment
9
10. Ajax
GET
PAGE
Models,
Validation,
Rendering,
Mess for GET
....
PAGE
complex
apps
Fragment
10
11. Ajax
Can get messy really fast
§ Loading multiple HTML fragments when
updating single entity
§ Handle validation errors from the server
§ Dependency between fragments,
multiple views need to change on update
§ TESTING!
11
47. Data, Events & Views
Pattern
§ User or server trigger data change, never update view directly
§ Data update triggers change event
§ Views subscribe to change events and re-render
§ Router to connect URLs to actions and initialize views
47