SlideShare a Scribd company logo
3.7.2012 (                 : 20.3.2012)

A Backbone.js Tutorial for the
Impatient
     Part 1: How to Get Your Hands Dirt with
     Backbone.js in 5 Minutes




 B : Jaakko Salonen (@jsalonen)

 I     :M   C   A       &S       C         .S                   .

 P                  QuickSlides <https://github.com/airport h/QuickSlides>
Prerequisites
  R         :


  D    '                                      ,


 Node.js

  U                                               -


  G                 ://       .       /

 Git

  U                                                   .
  G                 ://   -       .       /

 D     ?N       '
Creating our project
  W      B
               ( '    )
  I


 C               :
 gtcoehts/gtu.o/baynbcbn-olrlt.i mpoet
  i ln tp:/ihbcmtrne/akoebiepaegt yrjc
 c mpoet
  d yrjc
 nd bidsre
  oe ul evr


  D     .i
         gt

  O           :8000

 IT'S ALIVE
Routers
     L '                             :

 I             R            apmdlseapej:
                            p/oue/ ml.s

     EapeRue =Bcbn.otretn(
     xml.otr   akoeRue.xed{
      rue:{
       ots
        ":"ne"
         " idx
       ,

      idx fnto( {
       ne: ucin)
       $'mi'.tl'h>el Wrd/1';
        (#an)hm(<1Hlo ol<h>)

     );


 H                          p/anj:
                            apmi.s

     iiilz:fnto( {
     ntaie ucin)
      ti.xmlRue =nwEapeRue(;
       hseapeotr  e xml.otr)
     ,



Building and validating
 B                          :
     nd bid
     oe ul


 I                 ,             tot ros.
                            Dn, ihu err.
                            oe

 S                              :
     nd bidsre
     oe ul evr


 C                     .R
           .
Views
 I                      DOM,     '
           .

 M        apmdlseapej (
          p/oue/ ml.s                 i d ):
                                       ne
     idx fnto( {
     ne: ucin)
      vridx=nwEapeVesIdx)
       a ne  e xml.iw.ne(;
      idxrne(;
       ne.edr)


     EapeVesIdx=Bcbn.iwetn(
     xml.iw.ne      akoeVe.xed{
      e:'mi'
       l #an,
      tmlt:"p/epae/ne.tl,
       epae aptmltsidxhm"
      rne:fnto( {
       edr ucin)
        vrve =ti;
         a iw   hs
        nmsaefthepaeti.epae fnto(ml {
         aepc.ecTmlt(hstmlt, ucintp)
          ve.linrTL=tp(nm:'ol')
           iwe.neHM   ml{ae wrd ;
         );

     );


 aptmltsid .tl
  p/epae/ne hm

     <1Hlo<=nm % fo aptmlt/ne.tl<h>
     h>el % ae > rm p/epaeidxhm!/1


 N                  (        '           )
Refactoring to Support Multiple
Pages (1/2)
 A    W
 apmdlseapej:
  p/oue/ ml.s

     EapeWbae=Bcbn.oe.xed{
     xml.epg    akoeMdletn(
      dfut:{
       eals
       tte 'nild,
        il: Utte'
       cnet 'ocnet
        otn: N otn'

     );


 A                :
     "pgi" "ne"
     :aed: idx


 A               id
                  ne   :

     idx fnto(aed {
     ne: ucinpgi)
      i(aed==udfnd {
       fpgi = neie)
       pgi =1
        aed  ;

      vridx=nwEapeVesIdx)
       a ne  e xml.iw.ne(;
      idxmdl=nwEapeWbae{i' pgi )
       ne.oe   e xml.epg('d: aed ;
      idxrne(;
       ne.edr)



 (        ...)
Refactoring to Support Multiple
Pages (2/2)
 P  W                  rne (
                       edr
 apmdlseapej)
  p/oue/ ml.s

 ve.linrTL=tp(iwmdltJO()
 iwe.neHM   mlve.oe.oSN);


 A            p/epae/ne hm:
             aptmltsid .tl

 <1HloPg #% i %!/1
 h>el ae <= d ><h>


 D   !T       URLS             :

     ://   :8000/
     ://   :8000/1
     ://   :8000/#99
Managing Models with a
Collection
 A                        (
 a p m d l s e a p e j ):
  p/oue/ ml.s

 EapeWbae =Bcbn.olcinetn(
 xml.epgs   akoeCleto.xed{
  mdl EapeWbae
   oe: xml.epg,
  /lcltrg:nwwno.tr(Wbae" / cmetfrnw
   /oaSoae e idwSoe"epgs) / omn o o
 );


 R       id
          ne   R        (   ):

 i(aed==udfnd {
 fpgi = neie)
  pgi =1
   aed  ;


 vrwbae =nwEapeWbae(;
 a epgs   e xml.epgs)
 /wbae.ec(;/ cmetfrnw
 /epgsfth) / omn o o
 vrti_ae=wbae.e(aed;
 a hspg    epgsgtpgi)

 i(ti_ae==udfnd){
 f hspg = neie
  ti_ae=nwEapeWbae{d pgi )
   hspg  e xml.epg(i: aed ;
  wbae.d(hspg)
   epgsadti_ae;
  /ti_aesv(;/ cmetfrnw
   /hspg.ae) / omn o o


 vridx=nwEapeVesIdx)
 a ne   e xml.iw.ne(;
 idxmdl=ti_ae
 ne.oe   hspg;
 idxrne(;
 ne.edr)


 T   (              )
Persisting Models with HTML5
localStorage
  G   bcbn.oaSoaej
      akoelcltrg.s
       . /  /B  .  S                     :
  S
  ast/slb/akoelcltrg.s
   sesj/isbcbn.oaSoaej

 A                  c n i . s(
                     ofgj             bcbn
                                       akoe
        ):
 "akoelcltrg" ".ast/slb/akoelcltrg"
 bcbn.oaSoae: ./sesj/isbcbn.oaSoae,

 ..
 .

 bcbn.oaSoae {
 akoelcltrg:
  dp:[uebcbn" "s!nesoe]
   es "s!akoe, ueudrcr",
  atc:"akoe
   tah Bcbn"
 ,


 apmdlseapej
  p/oue/ ml.s                        dfn (
                                      eie
    u e b c b n " ):
   "s!akoe,

 "s!akoelcltrg"
 uebcbn.oaSoae


 Uncomment lines from previous slide

 B                                           S
               .R    . .   F     :
 cnoedrlcltrg)
 osl.i(oaSoae;
Adding Flesh - Edit Content
 N             (      ),
        .

 aptmltsid .tl
  p/epae/ne hm

 <1cas"aette>% tte% (<=i %)/1
 h ls=pg-il"<= il > #% d ><h>
 <i cas"aecnet>
 dv ls=pg-otn"
  <i cas"dtrhde"
   dv ls=eio idn>
   <>txae rw=2"cl=8"<txae>/>
    p<etra os"5 os"0>/etra<p
   <>ipttp=sbi"vle"ae>/nu>/>
    p<nu ye"umt au=Sv"<ipt<p
  <dv
   /i>
  <i cas"edrd>% cnet%<dv
   dv ls=rnee"<= otn >/i>
 <dv
 /i>


 apmdlseapej
  p/oue/ ml.s
 EapeVesId :
   ml.i .ne

 eet:{
 vns
  "lc .aecnet.edrd:"dtotn"
   cik pg-otn rnee" eiCnet
 ,
 eiCnet fnto( {
 dtotn: ucin)
  vrcnet=ti.oe.e(cnet)
   a otn  hsmdlgt'otn';
  $'pg-otn .edrd)hd(;
   (.aecnet rnee'.ie)
  $'pg-otn .dtr)rmvCas'idn)
   (.aecnet eio'.eoels(hde';
  $'pg-otn .dtrtxae'.tlcnet;
   (.aecnet eio etra)hm(otn)
 ,
Adding Flesh - Save Edited
Content
 apmdlseapej
  p/oue/ ml.s

 eet:{
 vns
  ..
   .
  "lc .aecnet.dtripttp=sbi'" "aeotn"
   cik pg-otn eio nu[ye'umt]: svCnet
 ,
 ..
 .
 svCnet fnto( {
 aeotn: ucin)
  vrcnet=$'pg-otn .dtrtxae'.a(;
   a otn  (.aecnet eio etra)vl)
  ti.oe.e(cnet,cnet;
   hsmdlst'otn' otn)
  ti.oe.ae)
   hsmdlsv(;

  $'pg-otn .dtr)adls(hde';
   (.aecnet eio'.dCas'idn)
  $'pg-otn .dtrtxae'.tl')
   (.aecnet eio etra)hm(';
  $'pg-otn .edrd)rmvCas'idn)
   (.aecnet rnee'.eoels(hde';

  ti.edr)
   hsrne(;
E e Cand - Markdown
Renderer Hook-up (1/2)
 L '              .   ( J   S   M
       )

 G          (
 . / s t / s l b / h d n j ):
  .aesj/isso o .s
 hts/gtu.o/ihbgtu-lvrdmrdw/lbg-ae/cit/hw
 tp:/ihbcmgtu/ihbfaoe-akonbo/hpgssrpsso


 apcni.s
  p/ofgj

 sodw:".ast/slb/hwon,
 hwon ./sesj/issodw"

 ue {
 s:
  ..
   .
  sodw:{
   hwon
    atc:"hwon
     tah Sodw"
E e Cand - Markdown
Renderer Hook-up (2/2)
 apmdlseapej
  p/oue/ ml.s

 "s!akoe,
 uebcbn"
 "s!hwon
 uesodw"

 ..
 .

 fnto(aepc,Bcbn,Sodw){
 ucinnmsae akoe hwon


 N                :

 aptmltsid .tl
  p/epae/ne hm

 <i cas"edrd>
 dv ls=rnee"
  < vrcnetr=nwSodw.ovre(;%
   % a ovre  e hwoncnetr) >
  <=cnetrmkHm(otn)%
   % ovre.aetlcnet >
 <dv
 /i>
Building for production
 R             (                    ):
 nd bid
 oe ul


 C                         .F            ,   :
 nd bid-hl
 oe ul -ep


 B             :
 nd bidrlae
 oe ul ees


 R                              :
 nd bidsre:ees
 oe ul evrrlae


 YSlow gives us Grade A (overall performance score 94)
See ou in Part 2
 Thank ou!
 J      S
     U e i e (@j a    e )f   e i   (f   e
     ecei e da e !)

More Related Content

What's hot

谈A国古代!%,%o现代l实现
谈A国古代!%,%o现代l实现谈A国古代!%,%o现代l实现
谈A国古代!%,%o现代l实现sugeladi
 
JavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring RooJavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring RooYasuharu Nakano
 
One page app with AngularJS
One page app with AngularJSOne page app with AngularJS
One page app with AngularJSAdam Štipák
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめようYuriko IKEDA
 
Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Oleg Zinchenko
 
Oliver Pirate Project
Oliver Pirate ProjectOliver Pirate Project
Oliver Pirate ProjectJoan Bennett
 
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_ЯндексеТанки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_ЯндексеYandex
 
Ember background basics
Ember background basicsEmber background basics
Ember background basicsPhilipp Fehre
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensionserwanl
 
Build a compiler in 2hrs - NCrafts Paris 2015
Build a compiler in 2hrs -  NCrafts Paris 2015Build a compiler in 2hrs -  NCrafts Paris 2015
Build a compiler in 2hrs - NCrafts Paris 2015Phillip Trelford
 
Create Custom Post Type Plugin
Create Custom Post Type PluginCreate Custom Post Type Plugin
Create Custom Post Type PluginJan Wilson
 
Javascript Common Mistakes
Javascript Common MistakesJavascript Common Mistakes
Javascript Common Mistakes동수 장
 
Python パッケージ構成
Python パッケージ構成Python パッケージ構成
Python パッケージ構成kei10in
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Riza Fahmi
 
Clojurescript up and running
Clojurescript up and runningClojurescript up and running
Clojurescript up and runningTimo Sulg
 

What's hot (20)

谈A国古代!%,%o现代l实现
谈A国古代!%,%o现代l实现谈A国古代!%,%o现代l实现
谈A国古代!%,%o现代l实现
 
JavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring RooJavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring Roo
 
One page app with AngularJS
One page app with AngularJSOne page app with AngularJS
One page app with AngularJS
 
Purpose
PurposePurpose
Purpose
 
2008 june 9
2008 june 92008 june 9
2008 june 9
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめよう
 
Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)
 
Oliver Pirate Project
Oliver Pirate ProjectOliver Pirate Project
Oliver Pirate Project
 
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_ЯндексеТанки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
Танки_в_Лунапарке: нагрузочное_тестирование_в_Яндексе
 
Ember background basics
Ember background basicsEmber background basics
Ember background basics
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
Build a compiler in 2hrs - NCrafts Paris 2015
Build a compiler in 2hrs -  NCrafts Paris 2015Build a compiler in 2hrs -  NCrafts Paris 2015
Build a compiler in 2hrs - NCrafts Paris 2015
 
Create Custom Post Type Plugin
Create Custom Post Type PluginCreate Custom Post Type Plugin
Create Custom Post Type Plugin
 
Javascript Common Mistakes
Javascript Common MistakesJavascript Common Mistakes
Javascript Common Mistakes
 
Python パッケージ構成
Python パッケージ構成Python パッケージ構成
Python パッケージ構成
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6
 
Clojurescript up and running
Clojurescript up and runningClojurescript up and running
Clojurescript up and running
 
Shell and perl scripting classes in mumbai
Shell and perl scripting classes in mumbaiShell and perl scripting classes in mumbai
Shell and perl scripting classes in mumbai
 
Alu car
Alu carAlu car
Alu car
 
Javascript: The Important Bits
Javascript: The Important BitsJavascript: The Important Bits
Javascript: The Important Bits
 

Similar to A Backbone.js Tutorial for the Impatient - Part 1

Angular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental FeatureAngular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental FeatureJonathan Magen
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleAri Lerner
 
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...Ari Lerner
 
Theme Development and Customization
Theme Development and CustomizationTheme Development and Customization
Theme Development and CustomizationAniket Pant
 
Automated tests - facts and myths
Automated tests - facts and mythsAutomated tests - facts and myths
Automated tests - facts and mythsWojciech Sznapka
 
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best PracticesJohannes Hoppe
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSPat Cito
 
Making the most of 2.2
Making the most of 2.2Making the most of 2.2
Making the most of 2.2markstory
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsHeroku
 
Tercera parte parte del Cuaderno de Ingles
Tercera parte parte del Cuaderno de InglesTercera parte parte del Cuaderno de Ingles
Tercera parte parte del Cuaderno de InglesRicardo Aguilar
 
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play FrameworkSecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Frameworkjaliss
 
Building modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaBuilding modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaAlexander Gyoshev
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaTony Fabeen
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scriptingTony Fabeen
 
Hubot: a look inside our robot friend
Hubot: a look inside our robot friendHubot: a look inside our robot friend
Hubot: a look inside our robot friendajacksified
 
Marko Gargenta_Remixing android
Marko Gargenta_Remixing androidMarko Gargenta_Remixing android
Marko Gargenta_Remixing androidDroidcon Berlin
 
Front End Dependency Management at CascadiaJS
Front End Dependency Management at CascadiaJSFront End Dependency Management at CascadiaJS
Front End Dependency Management at CascadiaJSJoe Sepi
 

Similar to A Backbone.js Tutorial for the Impatient - Part 1 (20)

Angular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental FeatureAngular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental Feature
 
Starting out with Ember.js
Starting out with Ember.jsStarting out with Ember.js
Starting out with Ember.js
 
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at GoogleBeginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
 
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
 
Theme Development and Customization
Theme Development and CustomizationTheme Development and Customization
Theme Development and Customization
 
Automated tests - facts and myths
Automated tests - facts and mythsAutomated tests - facts and myths
Automated tests - facts and myths
 
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
2013-02-21 - .NET UG Rhein-Neckar: JavaScript Best Practices
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Making the most of 2.2
Making the most of 2.2Making the most of 2.2
Making the most of 2.2
 
Noah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku SecretsNoah Zoschke at Waza 2013: Heroku Secrets
Noah Zoschke at Waza 2013: Heroku Secrets
 
JavaFX, because you're worth it
JavaFX, because you're worth itJavaFX, because you're worth it
JavaFX, because you're worth it
 
Tercera parte parte del Cuaderno de Ingles
Tercera parte parte del Cuaderno de InglesTercera parte parte del Cuaderno de Ingles
Tercera parte parte del Cuaderno de Ingles
 
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play FrameworkSecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Framework
 
Building modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and javaBuilding modern web apps with html5, javascript, and java
Building modern web apps with html5, javascript, and java
 
Nginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with LuaNginx Scripting - Extending Nginx Functionalities with Lua
Nginx Scripting - Extending Nginx Functionalities with Lua
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
 
Hubot: a look inside our robot friend
Hubot: a look inside our robot friendHubot: a look inside our robot friend
Hubot: a look inside our robot friend
 
Ff to-fp
Ff to-fpFf to-fp
Ff to-fp
 
Marko Gargenta_Remixing android
Marko Gargenta_Remixing androidMarko Gargenta_Remixing android
Marko Gargenta_Remixing android
 
Front End Dependency Management at CascadiaJS
Front End Dependency Management at CascadiaJSFront End Dependency Management at CascadiaJS
Front End Dependency Management at CascadiaJS
 

Recently uploaded

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...Sri Ambati
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Product School
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀DianaGray10
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...Product School
 

Recently uploaded (20)

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 

A Backbone.js Tutorial for the Impatient - Part 1

  • 1. 3.7.2012 ( : 20.3.2012) A Backbone.js Tutorial for the Impatient Part 1: How to Get Your Hands Dirt with Backbone.js in 5 Minutes B : Jaakko Salonen (@jsalonen) I :M C A &S C .S . P QuickSlides <https://github.com/airport h/QuickSlides>
  • 2. Prerequisites R : D ' , Node.js U - G :// . / Git U . G :// - . / D ?N '
  • 3. Creating our project W B ( ' ) I C : gtcoehts/gtu.o/baynbcbn-olrlt.i mpoet i ln tp:/ihbcmtrne/akoebiepaegt yrjc c mpoet d yrjc nd bidsre oe ul evr D .i gt O :8000 IT'S ALIVE
  • 4. Routers L ' : I R apmdlseapej: p/oue/ ml.s EapeRue =Bcbn.otretn( xml.otr akoeRue.xed{ rue:{ ots ":"ne" " idx , idx fnto( { ne: ucin) $'mi'.tl'h>el Wrd/1'; (#an)hm(<1Hlo ol<h>) ); H p/anj: apmi.s iiilz:fnto( { ntaie ucin) ti.xmlRue =nwEapeRue(; hseapeotr e xml.otr) , Building and validating B : nd bid oe ul I , tot ros. Dn, ihu err. oe S : nd bidsre oe ul evr C .R .
  • 5. Views I DOM, ' . M apmdlseapej ( p/oue/ ml.s i d ): ne idx fnto( { ne: ucin) vridx=nwEapeVesIdx) a ne e xml.iw.ne(; idxrne(; ne.edr) EapeVesIdx=Bcbn.iwetn( xml.iw.ne akoeVe.xed{ e:'mi' l #an, tmlt:"p/epae/ne.tl, epae aptmltsidxhm" rne:fnto( { edr ucin) vrve =ti; a iw hs nmsaefthepaeti.epae fnto(ml { aepc.ecTmlt(hstmlt, ucintp) ve.linrTL=tp(nm:'ol') iwe.neHM ml{ae wrd ; ); ); aptmltsid .tl p/epae/ne hm <1Hlo<=nm % fo aptmlt/ne.tl<h> h>el % ae > rm p/epaeidxhm!/1 N ( ' )
  • 6. Refactoring to Support Multiple Pages (1/2) A W apmdlseapej: p/oue/ ml.s EapeWbae=Bcbn.oe.xed{ xml.epg akoeMdletn( dfut:{ eals tte 'nild, il: Utte' cnet 'ocnet otn: N otn' ); A : "pgi" "ne" :aed: idx A id ne : idx fnto(aed { ne: ucinpgi) i(aed==udfnd { fpgi = neie) pgi =1 aed ; vridx=nwEapeVesIdx) a ne e xml.iw.ne(; idxmdl=nwEapeWbae{i' pgi ) ne.oe e xml.epg('d: aed ; idxrne(; ne.edr) ( ...)
  • 7. Refactoring to Support Multiple Pages (2/2) P W rne ( edr apmdlseapej) p/oue/ ml.s ve.linrTL=tp(iwmdltJO() iwe.neHM mlve.oe.oSN); A p/epae/ne hm: aptmltsid .tl <1HloPg #% i %!/1 h>el ae <= d ><h> D !T URLS : :// :8000/ :// :8000/1 :// :8000/#99
  • 8. Managing Models with a Collection A ( a p m d l s e a p e j ): p/oue/ ml.s EapeWbae =Bcbn.olcinetn( xml.epgs akoeCleto.xed{ mdl EapeWbae oe: xml.epg, /lcltrg:nwwno.tr(Wbae" / cmetfrnw /oaSoae e idwSoe"epgs) / omn o o ); R id ne R ( ): i(aed==udfnd { fpgi = neie) pgi =1 aed ; vrwbae =nwEapeWbae(; a epgs e xml.epgs) /wbae.ec(;/ cmetfrnw /epgsfth) / omn o o vrti_ae=wbae.e(aed; a hspg epgsgtpgi) i(ti_ae==udfnd){ f hspg = neie ti_ae=nwEapeWbae{d pgi ) hspg e xml.epg(i: aed ; wbae.d(hspg) epgsadti_ae; /ti_aesv(;/ cmetfrnw /hspg.ae) / omn o o vridx=nwEapeVesIdx) a ne e xml.iw.ne(; idxmdl=ti_ae ne.oe hspg; idxrne(; ne.edr) T ( )
  • 9. Persisting Models with HTML5 localStorage G bcbn.oaSoaej akoelcltrg.s . / /B . S : S ast/slb/akoelcltrg.s sesj/isbcbn.oaSoaej A c n i . s( ofgj bcbn akoe ): "akoelcltrg" ".ast/slb/akoelcltrg" bcbn.oaSoae: ./sesj/isbcbn.oaSoae, .. . bcbn.oaSoae { akoelcltrg: dp:[uebcbn" "s!nesoe] es "s!akoe, ueudrcr", atc:"akoe tah Bcbn" , apmdlseapej p/oue/ ml.s dfn ( eie u e b c b n " ): "s!akoe, "s!akoelcltrg" uebcbn.oaSoae Uncomment lines from previous slide B S .R . . F : cnoedrlcltrg) osl.i(oaSoae;
  • 10. Adding Flesh - Edit Content N ( ), . aptmltsid .tl p/epae/ne hm <1cas"aette>% tte% (<=i %)/1 h ls=pg-il"<= il > #% d ><h> <i cas"aecnet> dv ls=pg-otn" <i cas"dtrhde" dv ls=eio idn> <>txae rw=2"cl=8"<txae>/> p<etra os"5 os"0>/etra<p <>ipttp=sbi"vle"ae>/nu>/> p<nu ye"umt au=Sv"<ipt<p <dv /i> <i cas"edrd>% cnet%<dv dv ls=rnee"<= otn >/i> <dv /i> apmdlseapej p/oue/ ml.s EapeVesId : ml.i .ne eet:{ vns "lc .aecnet.edrd:"dtotn" cik pg-otn rnee" eiCnet , eiCnet fnto( { dtotn: ucin) vrcnet=ti.oe.e(cnet) a otn hsmdlgt'otn'; $'pg-otn .edrd)hd(; (.aecnet rnee'.ie) $'pg-otn .dtr)rmvCas'idn) (.aecnet eio'.eoels(hde'; $'pg-otn .dtrtxae'.tlcnet; (.aecnet eio etra)hm(otn) ,
  • 11. Adding Flesh - Save Edited Content apmdlseapej p/oue/ ml.s eet:{ vns .. . "lc .aecnet.dtripttp=sbi'" "aeotn" cik pg-otn eio nu[ye'umt]: svCnet , .. . svCnet fnto( { aeotn: ucin) vrcnet=$'pg-otn .dtrtxae'.a(; a otn (.aecnet eio etra)vl) ti.oe.e(cnet,cnet; hsmdlst'otn' otn) ti.oe.ae) hsmdlsv(; $'pg-otn .dtr)adls(hde'; (.aecnet eio'.dCas'idn) $'pg-otn .dtrtxae'.tl') (.aecnet eio etra)hm('; $'pg-otn .edrd)rmvCas'idn) (.aecnet rnee'.eoels(hde'; ti.edr) hsrne(;
  • 12. E e Cand - Markdown Renderer Hook-up (1/2) L ' . ( J S M ) G ( . / s t / s l b / h d n j ): .aesj/isso o .s hts/gtu.o/ihbgtu-lvrdmrdw/lbg-ae/cit/hw tp:/ihbcmgtu/ihbfaoe-akonbo/hpgssrpsso apcni.s p/ofgj sodw:".ast/slb/hwon, hwon ./sesj/issodw" ue { s: .. . sodw:{ hwon atc:"hwon tah Sodw"
  • 13. E e Cand - Markdown Renderer Hook-up (2/2) apmdlseapej p/oue/ ml.s "s!akoe, uebcbn" "s!hwon uesodw" .. . fnto(aepc,Bcbn,Sodw){ ucinnmsae akoe hwon N : aptmltsid .tl p/epae/ne hm <i cas"edrd> dv ls=rnee" < vrcnetr=nwSodw.ovre(;% % a ovre e hwoncnetr) > <=cnetrmkHm(otn)% % ovre.aetlcnet > <dv /i>
  • 14. Building for production R ( ): nd bid oe ul C .F , : nd bid-hl oe ul -ep B : nd bidrlae oe ul ees R : nd bidsre:ees oe ul evrrlae YSlow gives us Grade A (overall performance score 94)
  • 15. See ou in Part 2 Thank ou! J S U e i e (@j a e )f e i (f e ecei e da e !)