SlideShare uma empresa Scribd logo
1 de 97
Baixar para ler offline
Little Opinions
Big Possibilities
@BackboneRails
Brian Mann
The Tools and Patterns for Building Large Scale
Backbone Applications
Atlanta, GA
What is a large
scale application?
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”
“
“
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”
“
“
What is not a large
scale application?
http://www.todomvc.com
TodoMVC
Raising the
Bar
Google Analytics
WordPress
Rdio
Pandora
• Multiple Routers
• View Management
• Nesting
• Cleanup
• Complex Events
• Lots of state changes
• Many Entities (Models / Collections)
Characteristics
= Ton of JS Files
Overcoming the
gap
Engineering is
serious business
Stop blaming
Backbone.
<EMBRACE IT>
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
“
“
Monolithic
Frameworks
Focused
Small Tools
Leverage the
Eco-system
Pick the Right Tool
• 2-way Data-Binding
• Nested Collections
• Advanced Querying
• Filtering / Sorting
• Grids
• View Models and
Computed Properties
Stickit / Rivets
BB.Associations
BB.Query
BB.Projections
BackGrid
BB.Mutators /
BB.Computed
Fields
Application
Architecture
What we get
• Routers
• Views
• Events
class Router extends Backbone.Router
routes:
"users" : "listUsers"
"users/new" : "newUser"
"users/:id" : "showUser"
"users/:id/edit" : "editUser"
"dashboard" : "showDashboard"
"admin/users" : "listAdminUsers"
"admin/users/:id" : "showAdminUser"
"contacts" : "listContacts"
"contacts/new" : "newContact"
"contacts/:id" : "showContact"
listUsers: ->
users = new Users
users.fetch()
usersView = new View({collection: users})
$("#users").html(usersView.render().el)
What we get
• Routers
• Views
• Events
class Router extends Backbone.Router
routes:
"users" : "listUsers"
"users/new" : "newUser"
"users/:id" : "showUser"
"users/:id/edit" : "editUser"
"dashboard" : "showDashboard"
"admin/users" : "listAdminUsers"
"admin/users/:id" : "showAdminUser"
"contacts" : "listContacts"
"contacts/new" : "newContact"
"contacts/:id" : "showContact"
listUsers: ->
users = new Users
users.fetch()
usersView = new View({collection: users})
$("#users").html(usersView.render().el)
What we get
• Routers
• Views
• Events
class Router extends Backbone.Router
routes:
"users" : "listUsers"
"users/new" : "newUser"
"users/:id" : "showUser"
"users/:id/edit" : "editUser"
"dashboard" : "showDashboard"
"admin/users" : "listAdminUsers"
"admin/users/:id" : "showAdminUser"
"contacts" : "listContacts"
"contacts/new" : "newContact"
"contacts/:id" : "showContact"
listUsers: ->
users = new Users
users.fetch()
usersView = new View({collection: users})
$("#users").html(usersView.render().el)
What we get
• Routers
• Views
• Events
class Router extends Backbone.Router
routes:
"users" : "listUsers"
"users/new" : "newUser"
"users/:id" : "showUser"
"users/:id/edit" : "editUser"
"dashboard" : "showDashboard"
"admin/users" : "listAdminUsers"
"admin/users/:id" : "showAdminUser"
"contacts" : "listContacts"
"contacts/new" : "newContact"
"contacts/:id" : "showContact"
listUsers: ->
users = new Users
users.fetch()
usersView = new View({collection: users})
$("#users").html(usersView.render().el)
What we get
• Routers
• Views
• Events
class Router extends Backbone.Router
routes:
"users" : "listUsers"
"users/new" : "newUser"
"users/:id" : "showUser"
"users/:id/edit" : "editUser"
"dashboard" : "showDashboard"
"admin/users" : "listAdminUsers"
"admin/users/:id" : "showAdminUser"
"contacts" : "listContacts"
"contacts/new" : "newContact"
"contacts/:id" : "showContact"
listUsers: ->
users = new Users
users.fetch()
usersView = new View({collection: users})
$("#users").html(usersView.render().el)
What we get
• Routers
• Views
• Events
class Router extends Backbone.Router
routes:
"users" : "listUsers"
"users/new" : "newUser"
"users/:id" : "showUser"
"users/:id/edit" : "editUser"
"dashboard" : "showDashboard"
"admin/users" : "listAdminUsers"
"admin/users/:id" : "showAdminUser"
"contacts" : "listContacts"
"contacts/new" : "newContact"
"contacts/:id" : "showContact"
listUsers: ->
users = new Users
users.fetch()
usersView = new View({collection: users})
$("#users").html(usersView.render().el)
• Application
• App Modules
• -Router
• -Controllers
• -Specialized Views
• Components
• Mixins
• Entities
• Config
Specialized Objects
• Application
• App Modules
• -Router
• -Controllers
• -Specialized Views
• Components
• Mixins
• Entities
• Config
Specialized Objects
• Application
• App Modules
• -Router
• -Controllers
• -Specialized Views
• Components
• Mixins
• Entities
• Config
• Modules
• Messaging Bus
• Request
• Command
• Pub / Sub
Specialized Objects
Visualize Our App
ULTIMATE CONTAINER
APPLICATION
Application
Entities
Users
Sales
Items
Contacts Notes
Components
Mixins
Config
Visualize Our App
ULTIMATE CONTAINER
APPLICATION
Application
Entities
Users
Sales
Items
Contacts Notes
Components
Mixins
Config
Visualize Our App
ULTIMATE CONTAINER
APPLICATION
Application
Entities
Users
Sales
Items
Contacts Notes
Components
Mixins
Config
Visualize Our App
ULTIMATE CONTAINER
APPLICATION
Application
Entities
Users
Sales
Items
Contacts Notes
Components
Mixins
Config
APPLICATION INSTANCE
#header-region
#main-region
#footer-region
Application Regions
Storing Entities
and Resources
New Controller
Show Controller
List Controller
Visualize Our App
RESOURCE AUTHORITY
APP MODULE
Application
App Module
Handlers
<Requests>
<Commands>
<Pub / Sub >
Router
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
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
Controller Concerns
It Giveth Life
layout = new List.Layout
Layout
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
Understands
View Dependencies
usersCollection = App.request "user:entities"
Layout
Controller Concerns
USERS
COLLECTION
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
USERS
COLLECTION
Listens & Responds
to View Events
Controller Concerns
Layout
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
USERS
COLLECTION
Listens & Responds
to View Events
Controller Concerns
Layout
@listenTo layout, "show", =>
@listUsers(usersCollection)
listUsers: (users) ->
new List.CollectionView({
collection: users
})
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
Collection View
Controller Concerns
Layout
USERS
COLLECTION+
layout.usersRegion.show(collectionView)
Layout
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
Requests Additional
Services / Components
Controller Concerns
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
Spinner
COMPONENTS
Form
OK
Name:
Address:
Grid
Controller Concerns
Item View
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
Spinner
COMPONENTS
Form
OK
Name:
Address:
Grid
Controller Concerns
Item View
Visualize Our App
Visual Composer
Controller
Item View
Layout
Collection View
Application
Controller
App Module
Spinner
COMPONENTS
Grid
Controller Concerns
Item View
Visualize Our App
Presentation Manager
View
Application
Controller
App Module
View
<DOM />
Template
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
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.
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
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
Visualize Our App
Presentation Manager
View
Application
Controller
App Module
View
<DOM />
Template
Specialized Views
Item View
Model
Collection View
Collection
Layout
Visualize Our App
Presentation Manager
<DOM />
Template
View
Application
Controller
App Module
View
Visualize Our App
Presentation Manager
<DOM />
Template
View
Application
Controller
App Module
View
Visualize Our App
Presentation Manager
<DOM />
Template
View
Application
Controller
App Module
View<section>
<div id="git-comment"><%= @comment %></div>
<div id="git-author">
Authored by <%= @author %> on <%= @date %>
</div>
<div id="git-diff">
Showing <%= @num_changed %> changed files
with <%= @num_additions %> additions.
</div>
</section>
www.backplug.io
www.backplug.io
Marionette JS
• Application
• App Router
• Controllers
• Specialized Views
• Layouts & Regions
• ItemView
• Collection View
• Composite View
• Modules
• Messaging Bus
• Request
• Command
• Pub / Sub
New Toys
Messaging Bus
Controller
Entities
APPLICATION
USERS
LIST SHOW NEW
ENTITIES
USER NOTE
NOTES
LIST NEW
App Modules Shared Resources
Messaging Bus
Controller
Entities
## backbone/apps/users/list/list_controller.js
@App.module "UsersApp.List", (List, App, Backbone, Marionette, $, _) ->
class List.Controller extends App.Controllers.Base
initialize: ->
users = App.request "user:entities"
## ...remaining code...
## backbone/apps/entities/user.js
@App.module "Entities", (Entities, App, Backbone, Marionette, $, _) ->
class User extends Entities.Model
class UsersCollection extends Entities.Collection
model: User
App.reqres.setHandler "user:entities", ->
users = new UsersCollection
users.fetch()
users
Messaging Bus
Controller
Entities
## backbone/apps/users/list/list_controller.js
@App.module "UsersApp.List", (List, App, Backbone, Marionette, $, _) ->
class List.Controller extends App.Controllers.Base
initialize: ->
users = App.request "user:entities"
## ...remaining code...
## backbone/apps/entities/user.js
@App.module "Entities", (Entities, App, Backbone, Marionette, $, _) ->
class User extends Entities.Model
class UsersCollection extends Entities.Collection
model: User
App.reqres.setHandler "user:entities", ->
users = new UsersCollection
users.fetch()
users
Messaging Bus
Controller
Entities
Messaging Bus
Controller
Entities
Application
Folder Organization
backbone
app.js
Folder Organization
backbone
app.js
apps
Folder Organization
backbone
app.js
apps
config
entities
components
mixins
base
Folder Organization
backbone
app.js
config
entities
components
mixins
base
playlist
playlist_songs
album
album_comments
currently_playing
apps
Folder Organization
backbone
app.js
config
entities
components
mixins
base
playlist
playlist_songs
album
album_comments
currently_playing
apps
Playlist.List
Playlist.New
Playlist.Show
Playlist.Show
Playlist.Show
Playlist.Edit
PlaylistSongs.List
CurrentlyPlaying.Show
CurrentlyPlaying.List
CurrentlyPlaying.List
apps
playlist
playlist_songs
list
show
currently_playing
playlist_app.js
edit
new
list
playlist_songs_app.js
list
currently_playing_app.js
show
apps
playlist
playlist_songs
list
show
currently_playing
playlist_app.js
edit
new
list
playlist_songs_app.js
list
currently_playing_app.js
show
apps
playlist
playlist_songs
list
show
currently_playing
playlist_app.js
edit
new
list
playlist_songs_app.js
list
currently_playing_app.js
show
apps
playlist
playlist_songs
list
show
currently_playing
playlist_app.js
edit
new
list
playlist_songs_app.js
list
currently_playing_app.js
show
The End
@BackboneRails
Brian Mann

Mais conteúdo relacionado

Mais procurados

SwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsSwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsScott Gardner
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web AppsJavascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Appsdnelson-cs
 
Resource and view
Resource and viewResource and view
Resource and viewPapp Laszlo
 
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlassian
 
Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and serverIntroducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and serverSpike Brehm
 
MVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineMVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineTai Lun Tseng
 
AtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and ServerAtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and ServerAtlassian
 
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Kazuyuki Kawamura
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Elyse Kolker Gordon
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
Applications: A Series of States
Applications: A Series of StatesApplications: A Series of States
Applications: A Series of StatesTrek Glowacki
 
Getting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUIGetting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUIScott Gardner
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screenMatteo Bonifazi
 
Supercharge Your Pages - New Ways to Extend the Confluence Editor
Supercharge Your Pages - New Ways to Extend the Confluence EditorSupercharge Your Pages - New Ways to Extend the Confluence Editor
Supercharge Your Pages - New Ways to Extend the Confluence EditorAtlassian
 
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlassian
 
Python Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - AppenginePython Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - AppenginePython Ireland
 
Course CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.jsCourse CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.jsVinícius de Moraes
 
Point and Click App Building Workshop
Point and Click App Building WorkshopPoint and Click App Building Workshop
Point and Click App Building WorkshopSalesforce Developers
 
Salesforce Lightning Events - Hands on Training
Salesforce Lightning Events - Hands on TrainingSalesforce Lightning Events - Hands on Training
Salesforce Lightning Events - Hands on TrainingSunil kumar
 

Mais procurados (20)

SwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsSwiftUI and Combine All the Things
SwiftUI and Combine All the Things
 
Javascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web AppsJavascript Frameworks for Well Architected, Immersive Web Apps
Javascript Frameworks for Well Architected, Immersive Web Apps
 
Resource and view
Resource and viewResource and view
Resource and view
 
AtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-onsAtlasCamp 2015: Using add-ons to build add-ons
AtlasCamp 2015: Using add-ons to build add-ons
 
Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and serverIntroducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and server
 
MVVM with SwiftUI and Combine
MVVM with SwiftUI and CombineMVVM with SwiftUI and Combine
MVVM with SwiftUI and Combine
 
AtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and ServerAtlasCamp 2015: Connect everywhere - Cloud and Server
AtlasCamp 2015: Connect everywhere - Cloud and Server
 
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
 
Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Applications: A Series of States
Applications: A Series of StatesApplications: A Series of States
Applications: A Series of States
 
Getting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUIGetting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUI
 
Invading the home screen
Invading the home screenInvading the home screen
Invading the home screen
 
Supercharge Your Pages - New Ways to Extend the Confluence Editor
Supercharge Your Pages - New Ways to Extend the Confluence EditorSupercharge Your Pages - New Ways to Extend the Confluence Editor
Supercharge Your Pages - New Ways to Extend the Confluence Editor
 
AtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using nowAtlasCamp 2015: Web technologies you should be using now
AtlasCamp 2015: Web technologies you should be using now
 
Python Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - AppenginePython Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - Appengine
 
Course CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.jsCourse CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.js
 
Point and Click App Building Workshop
Point and Click App Building WorkshopPoint and Click App Building Workshop
Point and Click App Building Workshop
 
Salesforce Lightning Events - Hands on Training
Salesforce Lightning Events - Hands on TrainingSalesforce Lightning Events - Hands on Training
Salesforce Lightning Events - Hands on Training
 

Semelhante a Little Opinions, Big Possibilities: The Tools and Patterns for Building Large Scale Backbone Applications

Create an application with ember
Create an application with ember Create an application with ember
Create an application with ember Chandra Sekar
 
Angular presentation
Angular presentationAngular presentation
Angular presentationMatus Szabo
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?Brenda Cook
 
Ruby on Rails : RESTful 和 Ajax
Ruby on Rails : RESTful 和 AjaxRuby on Rails : RESTful 和 Ajax
Ruby on Rails : RESTful 和 AjaxWen-Tien Chang
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSmurtazahaveliwala
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular jsAayush Shrestha
 
Advanced Cojure Microservices
Advanced Cojure MicroservicesAdvanced Cojure Microservices
Advanced Cojure Microservicesinovex GmbH
 
Обзор Android M
Обзор Android MОбзор Android M
Обзор Android MWOX APP
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basicsAnton Narusberg
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2Vivek Bhusal
 
I/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in AndroidI/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in AndroidSittiphol Phanvilai
 
Getting into ember.js
Getting into ember.jsGetting into ember.js
Getting into ember.jsreybango
 
Emberjs as a rails_developer
Emberjs as a rails_developer Emberjs as a rails_developer
Emberjs as a rails_developer Sameera Gayan
 
Advanced RESTful Rails
Advanced RESTful RailsAdvanced RESTful Rails
Advanced RESTful RailsViget Labs
 
Advanced RESTful Rails
Advanced RESTful RailsAdvanced RESTful Rails
Advanced RESTful RailsBen Scofield
 
WordPress hooks - WPLDN July 2013 Meetup
WordPress hooks - WPLDN July 2013 MeetupWordPress hooks - WPLDN July 2013 Meetup
WordPress hooks - WPLDN July 2013 Meetupl3rady
 

Semelhante a Little Opinions, Big Possibilities: The Tools and Patterns for Building Large Scale Backbone Applications (20)

Create an application with ember
Create an application with ember Create an application with ember
Create an application with ember
 
Angular presentation
Angular presentationAngular presentation
Angular presentation
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Ruby on Rails : RESTful 和 Ajax
Ruby on Rails : RESTful 和 AjaxRuby on Rails : RESTful 和 Ajax
Ruby on Rails : RESTful 和 Ajax
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Advanced Cojure Microservices
Advanced Cojure MicroservicesAdvanced Cojure Microservices
Advanced Cojure Microservices
 
Обзор Android M
Обзор Android MОбзор Android M
Обзор Android M
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basics
 
Training Session 2 - Day 2
Training Session 2 - Day 2Training Session 2 - Day 2
Training Session 2 - Day 2
 
I/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in AndroidI/O Rewind 215: What's new in Android
I/O Rewind 215: What's new in Android
 
Getting into ember.js
Getting into ember.jsGetting into ember.js
Getting into ember.js
 
AngularJS
AngularJSAngularJS
AngularJS
 
Presentation
PresentationPresentation
Presentation
 
Emberjs as a rails_developer
Emberjs as a rails_developer Emberjs as a rails_developer
Emberjs as a rails_developer
 
Advanced RESTful Rails
Advanced RESTful RailsAdvanced RESTful Rails
Advanced RESTful Rails
 
Advanced RESTful Rails
Advanced RESTful RailsAdvanced RESTful Rails
Advanced RESTful Rails
 
Meteor.js for DOers
Meteor.js for DOersMeteor.js for DOers
Meteor.js for DOers
 
WordPress hooks - WPLDN July 2013 Meetup
WordPress hooks - WPLDN July 2013 MeetupWordPress hooks - WPLDN July 2013 Meetup
WordPress hooks - WPLDN July 2013 Meetup
 

Último

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Último (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

Little Opinions, Big Possibilities: The Tools and Patterns for Building Large Scale Backbone Applications

  • 1. Little Opinions Big Possibilities @BackboneRails Brian Mann The Tools and Patterns for Building Large Scale Backbone Applications Atlanta, GA
  • 2.
  • 3.
  • 4. What is a large scale application?
  • 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” “ “
  • 7. What is not a large scale application?
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. • Multiple Routers • View Management • Nesting • Cleanup • Complex Events • Lots of state changes • Many Entities (Models / Collections) Characteristics = Ton of JS Files
  • 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 “ “
  • 30. Pick the Right Tool • 2-way Data-Binding • Nested Collections • Advanced Querying • Filtering / Sorting • Grids • View Models and Computed Properties Stickit / Rivets BB.Associations BB.Query BB.Projections BackGrid BB.Mutators / BB.Computed Fields
  • 32. What we get • Routers • Views • Events class Router extends Backbone.Router routes: "users" : "listUsers" "users/new" : "newUser" "users/:id" : "showUser" "users/:id/edit" : "editUser" "dashboard" : "showDashboard" "admin/users" : "listAdminUsers" "admin/users/:id" : "showAdminUser" "contacts" : "listContacts" "contacts/new" : "newContact" "contacts/:id" : "showContact" listUsers: -> users = new Users users.fetch() usersView = new View({collection: users}) $("#users").html(usersView.render().el)
  • 33. What we get • Routers • Views • Events class Router extends Backbone.Router routes: "users" : "listUsers" "users/new" : "newUser" "users/:id" : "showUser" "users/:id/edit" : "editUser" "dashboard" : "showDashboard" "admin/users" : "listAdminUsers" "admin/users/:id" : "showAdminUser" "contacts" : "listContacts" "contacts/new" : "newContact" "contacts/:id" : "showContact" listUsers: -> users = new Users users.fetch() usersView = new View({collection: users}) $("#users").html(usersView.render().el)
  • 34. What we get • Routers • Views • Events class Router extends Backbone.Router routes: "users" : "listUsers" "users/new" : "newUser" "users/:id" : "showUser" "users/:id/edit" : "editUser" "dashboard" : "showDashboard" "admin/users" : "listAdminUsers" "admin/users/:id" : "showAdminUser" "contacts" : "listContacts" "contacts/new" : "newContact" "contacts/:id" : "showContact" listUsers: -> users = new Users users.fetch() usersView = new View({collection: users}) $("#users").html(usersView.render().el)
  • 35. What we get • Routers • Views • Events class Router extends Backbone.Router routes: "users" : "listUsers" "users/new" : "newUser" "users/:id" : "showUser" "users/:id/edit" : "editUser" "dashboard" : "showDashboard" "admin/users" : "listAdminUsers" "admin/users/:id" : "showAdminUser" "contacts" : "listContacts" "contacts/new" : "newContact" "contacts/:id" : "showContact" listUsers: -> users = new Users users.fetch() usersView = new View({collection: users}) $("#users").html(usersView.render().el)
  • 36. What we get • Routers • Views • Events class Router extends Backbone.Router routes: "users" : "listUsers" "users/new" : "newUser" "users/:id" : "showUser" "users/:id/edit" : "editUser" "dashboard" : "showDashboard" "admin/users" : "listAdminUsers" "admin/users/:id" : "showAdminUser" "contacts" : "listContacts" "contacts/new" : "newContact" "contacts/:id" : "showContact" listUsers: -> users = new Users users.fetch() usersView = new View({collection: users}) $("#users").html(usersView.render().el)
  • 37. What we get • Routers • Views • Events class Router extends Backbone.Router routes: "users" : "listUsers" "users/new" : "newUser" "users/:id" : "showUser" "users/:id/edit" : "editUser" "dashboard" : "showDashboard" "admin/users" : "listAdminUsers" "admin/users/:id" : "showAdminUser" "contacts" : "listContacts" "contacts/new" : "newContact" "contacts/:id" : "showContact" listUsers: -> users = new Users users.fetch() usersView = new View({collection: users}) $("#users").html(usersView.render().el)
  • 38. • Application • App Modules • -Router • -Controllers • -Specialized Views • Components • Mixins • Entities • Config Specialized Objects
  • 39. • Application • App Modules • -Router • -Controllers • -Specialized Views • Components • Mixins • Entities • Config Specialized Objects
  • 40. • Application • App Modules • -Router • -Controllers • -Specialized Views • Components • Mixins • Entities • Config • Modules • Messaging Bus • Request • Command • Pub / Sub Specialized Objects
  • 41. Visualize Our App ULTIMATE CONTAINER APPLICATION Application Entities Users Sales Items Contacts Notes Components Mixins Config
  • 42. Visualize Our App ULTIMATE CONTAINER APPLICATION Application Entities Users Sales Items Contacts Notes Components Mixins Config
  • 43. Visualize Our App ULTIMATE CONTAINER APPLICATION Application Entities Users Sales Items Contacts Notes Components Mixins Config
  • 44. Visualize Our App ULTIMATE CONTAINER APPLICATION Application Entities Users Sales Items Contacts Notes Components Mixins Config APPLICATION INSTANCE #header-region #main-region #footer-region Application Regions Storing Entities and Resources
  • 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
  • 47. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module
  • 48. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module Controller Concerns It Giveth Life layout = new List.Layout Layout
  • 49. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module Understands View Dependencies usersCollection = App.request "user:entities" Layout Controller Concerns USERS COLLECTION
  • 50. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module USERS COLLECTION Listens & Responds to View Events Controller Concerns Layout
  • 51. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module USERS COLLECTION Listens & Responds to View Events Controller Concerns Layout @listenTo layout, "show", => @listUsers(usersCollection) listUsers: (users) -> new List.CollectionView({ collection: users })
  • 52. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module Collection View Controller Concerns Layout USERS COLLECTION+ layout.usersRegion.show(collectionView) Layout
  • 53. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module Requests Additional Services / Components Controller Concerns
  • 54. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module Spinner COMPONENTS Form OK Name: Address: Grid Controller Concerns Item View
  • 55. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module Spinner COMPONENTS Form OK Name: Address: Grid Controller Concerns Item View
  • 56. Visualize Our App Visual Composer Controller Item View Layout Collection View Application Controller App Module Spinner COMPONENTS Grid Controller Concerns Item View
  • 57. Visualize Our App Presentation Manager View Application Controller App Module View <DOM /> Template
  • 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
  • 62. Visualize Our App Presentation Manager View Application Controller App Module View <DOM /> Template Specialized Views Item View Model Collection View Collection Layout
  • 63. Visualize Our App Presentation Manager <DOM /> Template View Application Controller App Module View
  • 64. Visualize Our App Presentation Manager <DOM /> Template View Application Controller App Module View
  • 65. Visualize Our App Presentation Manager <DOM /> Template View Application Controller App Module View<section> <div id="git-comment"><%= @comment %></div> <div id="git-author"> Authored by <%= @author %> on <%= @date %> </div> <div id="git-diff"> Showing <%= @num_changed %> changed files with <%= @num_additions %> additions. </div> </section>
  • 69. • Application • App Router • Controllers • Specialized Views • Layouts & Regions • ItemView • Collection View • Composite View • Modules • Messaging Bus • Request • Command • Pub / Sub New Toys
  • 71. APPLICATION USERS LIST SHOW NEW ENTITIES USER NOTE NOTES LIST NEW App Modules Shared Resources
  • 72. Messaging Bus Controller Entities ## backbone/apps/users/list/list_controller.js @App.module "UsersApp.List", (List, App, Backbone, Marionette, $, _) -> class List.Controller extends App.Controllers.Base initialize: -> users = App.request "user:entities" ## ...remaining code... ## backbone/apps/entities/user.js @App.module "Entities", (Entities, App, Backbone, Marionette, $, _) -> class User extends Entities.Model class UsersCollection extends Entities.Collection model: User App.reqres.setHandler "user:entities", -> users = new UsersCollection users.fetch() users
  • 73. Messaging Bus Controller Entities ## backbone/apps/users/list/list_controller.js @App.module "UsersApp.List", (List, App, Backbone, Marionette, $, _) -> class List.Controller extends App.Controllers.Base initialize: -> users = App.request "user:entities" ## ...remaining code... ## backbone/apps/entities/user.js @App.module "Entities", (Entities, App, Backbone, Marionette, $, _) -> class User extends Entities.Model class UsersCollection extends Entities.Collection model: User App.reqres.setHandler "user:entities", -> users = new UsersCollection users.fetch() users
  • 82.
  • 84.