I gave this talk July 31 at BackboneConf 2013 in Boston, MA
backboneconf.com
Backbone has been used to build some of the greatest web apps in the world. Chances are, you have one running in your tabs. But the gap from first starting Backbone to building a large application is enormous. In this talk, Brian Mann will focus on closing that gap, and pave the way for creating powerful and highly scalable Backbone Apps.
One of the biggest pain points of Backbone is dealing with its boilerplate code. Let’s face it; Backbone is notorious for being small and un-opinionated. While an attractive feature, it unfortunately means automation and workflow falls on developer’s shoulders. This often results in bloated code bases, reinvented patterns, frustration, and wasted time.
Instead of building your application’s infrastructure from scratch, Brian will show you how to become a much happier Backbone developer by demonstrating how to build modular Backbone apps using Marionette JS.
For videos and screencasts visit:
http://www.backbonerails.com
5. In my view, large-scale Javascript
apps are non-trivial applications
requiring significant developer
effort to maintain, where most
heavy lifting of data manipulation
and display falls to the browser.
Addy Osmani
“Patterns For Large-Scale JavaScript Application Architecture”
“
“
6. If working on a significantly large
Javascript application, remember
to dedicate sufficient time to
planning the underlying
architecture that makes the most
sense. It's often more complex
than you may initially imagine.
Addy Osmani
“Patterns For Large-Scale JavaScript Application Architecture”
“
“
27. The essential premise at the heart of Backbone has
always been to try and discover the minimal set of
data-structuring (Models and Collections) and user
interface (Views and URLs) primitives that are useful
when building web applications with JavaScript.
...In an ecosystem where overarching, decides-
everything-for-you frameworks are commonplace,
and many libraries require your site to be
restructured to suit their look, feel, and default
behavior — Backbone should continue to be a tool
that gives you the freedom to design the full
experience of your web application.
Jeremy Ashkenas
Releasing Backbone v1.0
“
“
45. New Controller
Show Controller
List Controller
Visualize Our App
RESOURCE AUTHORITY
APP MODULE
Application
App Module
Handlers
<Requests>
<Commands>
<Pub / Sub >
Router
46. New Controller
Show Controller
List Controller
Visualize Our App
RESOURCE AUTHORITY
APP MODULE
Application
App Module
Handlers
<Requests>
<Commands>
<Pub / Sub >
Router
THE GATEKEEPER
USERS
LIST
SHOW
NEW
ADMIN
USERS
LIST
EDIT
DASHBOARD
USERS
LIST
<App Request>
<App Command>
/users
/users/:id
/users/new
58. Visualize Our App
Presentation Manager
View
Application
Controller
App Module
View
<DOM />
Template
Event Method When This Event Triggers
before:render onBeforeRender
before view’s $el has been rendered
into the DOM
render onRender
view’s $el has been inserted,
allowing you to work with the DOM
show onShow
a!er a view has been inserted by a
region into the DOM
dom:refresh onDomRefresh
a!er a view has been shown but has
been re-rendered at a later time
before:close onBeforeClose
view has been told to close. return
false to prevent it from closing
close onClose
a!er view is closed. run custom
code such as additional cleanup
59. Visualize Our App
Presentation Manager
View
Application
Controller
App Module
View
<DOM />
Template
class App.Views.SomeView extends Base.View
mixin: ["focusable", "selectable"]
onRender: ->
## We know we’re rendered, so manipulate the DOM.
## Now’s a great time to initialize a jQuery
plugin.
onClose: ->
## We know we’re about to be closed down.
## This is when we unbind / cleanup things we may
have initialized at an earlier point.
60. Visualize Our App
Presentation Manager
View
Application
Controller
App Module
View
<DOM />
Template
class App.Views.SomeView extends Base.View
mixin: ["focusable", "selectable"]
onRender: ->
## We know we’re rendered, so manipulate the DOM.
## Now’s a great time to initialize a jQuery
plugin.
onClose: ->
## We know we’re about to be closed down.
## This is when we unbind / cleanup things we may
have initialized at an earlier point.
initialize: ->
someModel = new App.Models.someModel
61. Visualize Our App
Presentation Manager
View
Application
Controller
App Module
View
<DOM />
Template
class App.Views.SomeView extends Base.View
mixin: ["focusable", "selectable"]
onRender: ->
## We know we’re rendered, so manipulate the DOM.
## Now’s a great time to initialize a jQuery
plugin.
onClose: ->
## We know we’re about to be closed down.
## This is when we unbind / cleanup things we may
have initialized at an earlier point.
initialize: ->
someModel = new App.Models.someModel