SlideShare une entreprise Scribd logo
1  sur  25
Télécharger pour lire hors ligne
Backbone.js in the Front-end
      David Corbacho Román
           Ethan Winn
David Corbacho Román

  C.S. Engineer
  Drupal & JavaScript specialist
  Google +1 module maintainer
  Twitter: @dcorbacho
  Blog: drupalmotion.com
Ethan Winn


Technical Director
Backbone module maintainer
twitter @eethann
The Future is a RESTful Drupal
                                            – Dries Buytaert




http://buytaert.net/the-future-is-a-restful-drupal
Levine´s Law: Start with the Demo
http://www.aberdeencloud.com
Web evolution




           Credit: Hjörtur Hilmarsson (@hjortureh) at 14islands.com
Write once, run everywhere
JavaScript is growing
JavaScript is getting fat
       Nov 2010                         July 2012

        113 kB                          215 kB




http://httparchive.org/trends.php
Help!
It’s Time for Lasagna Code
Backbone

Backbone.js gives structure to web applications by
providing models , collections and
views connecting all to your existing API over a
RESTful JSON interface.

Dependencies:      underscore.js , jQuery
Author:            Jeremy Ashkenas
License:           MIT
But.. jQuery is not enough?
                        jQuery
         XHR [Ajax]


ECMAScript        DOM          BOM
                      Events
Backbone.js
   Decoupling data from DOM
     REST API


MODEL                      VIEW
holds raw data             holds a HTML element

Change in data    Events          Render data
Backbone.js Vs …
   Knockout.js                                   Ember.js
                        Angularjs
      Spine                          Batman.js
                 Sproutcore
 Cappucino                          JavascriptMVC
              CanJS

Sammy.js              Knockback
                                             Agility.js
       Stapes
                       Fidel
Backbone.js Vs …




http://xkcd.com/927/
Why Backbone.js is leading in
JavaScript MVC frameworks?

   * the first
   * more resources and community
   * small
Backbone Philosophy




Focus in 1 thing. Minimalistic. 80% rule
Agnostic
Expand it. Override it
800 LOC
Dont’s
Don’t use Backbone for small things
Don’t use it if SEO is important
Don’t use it if you are in a rush.
Don’t CoffeeScript until you JavaScript
Don’t use extra add-ons on top of Backbone
until you know Backbone.
Don’t learn it by theory: It’s MV*.
Backend Vs Frontend




Damn Backbone, you are taking too
much control. Over my dead body!
The #ahah moment
Drupal 6 : Let’s program JavaScript with PHP Arrays,
why not?




Drupal 7: Ajax from PHP: more metaprogramming
Drupal 8

Please don’t.

Embrace JavaScript,
Let it be part of “the Drupal way”

Thanks to Larry Gardfield & WSCCI Initiative
Thank you

Link with extended slides : twitter @dcorbacho

       Ethan will continue now …

Contenu connexe

Tendances

The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.jsThe MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.jsMongoDB
 
Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3Karambir Singh Nain
 
JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3Helder da Rocha
 
Javascript fatigue, 자바스크립트 피로
Javascript fatigue, 자바스크립트 피로Javascript fatigue, 자바스크립트 피로
Javascript fatigue, 자바스크립트 피로Rhio Kim
 
Rockstar Graphics with HTML5
Rockstar Graphics with HTML5Rockstar Graphics with HTML5
Rockstar Graphics with HTML5Dave Balmer
 
Beyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Beyond the MEAN Stack: Thinking Small with Node.js for the EnterpriseBeyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Beyond the MEAN Stack: Thinking Small with Node.js for the EnterpriseForrest Norvell
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB
 
The Modern Java Web Developer Bootcamp - Devoxx 2013
The Modern Java Web Developer Bootcamp - Devoxx 2013The Modern Java Web Developer Bootcamp - Devoxx 2013
The Modern Java Web Developer Bootcamp - Devoxx 2013Matt Raible
 
Introduction to mean stack
Introduction to mean stackIntroduction to mean stack
Introduction to mean stackPraveen Gubbala
 
Using Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the WebUsing Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the Webphilogb
 
Starting from Scratch with the MEAN Stack
Starting from Scratch with the MEAN StackStarting from Scratch with the MEAN Stack
Starting from Scratch with the MEAN StackMongoDB
 
Thats Not Flash?
Thats Not Flash?Thats Not Flash?
Thats Not Flash?Mike Wilcox
 
Mean Stack - An Overview
Mean Stack - An OverviewMean Stack - An Overview
Mean Stack - An OverviewNaveen Pete
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stackNicholas McClay
 
NodeSummit - MEAN Stack
NodeSummit - MEAN StackNodeSummit - MEAN Stack
NodeSummit - MEAN StackValeri Karpov
 

Tendances (20)

Learn svg
Learn svgLearn svg
Learn svg
 
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.jsThe MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
 
Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3Building a Better Web with HTML5 and CSS3
Building a Better Web with HTML5 and CSS3
 
JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3JavaONE 2012 Using Java with HTML5 and CSS3
JavaONE 2012 Using Java with HTML5 and CSS3
 
Javascript fatigue, 자바스크립트 피로
Javascript fatigue, 자바스크립트 피로Javascript fatigue, 자바스크립트 피로
Javascript fatigue, 자바스크립트 피로
 
Rockstar Graphics with HTML5
Rockstar Graphics with HTML5Rockstar Graphics with HTML5
Rockstar Graphics with HTML5
 
Beyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Beyond the MEAN Stack: Thinking Small with Node.js for the EnterpriseBeyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
Beyond the MEAN Stack: Thinking Small with Node.js for the Enterprise
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
 
The Modern Java Web Developer Bootcamp - Devoxx 2013
The Modern Java Web Developer Bootcamp - Devoxx 2013The Modern Java Web Developer Bootcamp - Devoxx 2013
The Modern Java Web Developer Bootcamp - Devoxx 2013
 
Introduction to mean stack
Introduction to mean stackIntroduction to mean stack
Introduction to mean stack
 
The MEAN Stack
The MEAN StackThe MEAN Stack
The MEAN Stack
 
Using Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the WebUsing Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the Web
 
Mean PPT
Mean PPTMean PPT
Mean PPT
 
Starting from Scratch with the MEAN Stack
Starting from Scratch with the MEAN StackStarting from Scratch with the MEAN Stack
Starting from Scratch with the MEAN Stack
 
Html5 more than just html5 v final
Html5  more than just html5 v finalHtml5  more than just html5 v final
Html5 more than just html5 v final
 
Thats Not Flash?
Thats Not Flash?Thats Not Flash?
Thats Not Flash?
 
Mean Stack - An Overview
Mean Stack - An OverviewMean Stack - An Overview
Mean Stack - An Overview
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stack
 
NodeSummit - MEAN Stack
NodeSummit - MEAN StackNodeSummit - MEAN Stack
NodeSummit - MEAN Stack
 

Similaire à Drupal Backbone.js in the Frontend

Organized web app development using backbone.js
Organized web app development using backbone.jsOrganized web app development using backbone.js
Organized web app development using backbone.jsShakti Shrestha
 
JavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceJavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceDmitry Sheiko
 
LA RubyConf 2009 Waves And Resource-Oriented Architecture
LA RubyConf 2009 Waves And Resource-Oriented ArchitectureLA RubyConf 2009 Waves And Resource-Oriented Architecture
LA RubyConf 2009 Waves And Resource-Oriented ArchitectureDan Yoder
 
Daniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDaniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDevelcz
 
SXSW 2012 JavaScript MythBusters
SXSW 2012 JavaScript MythBustersSXSW 2012 JavaScript MythBusters
SXSW 2012 JavaScript MythBustersElena-Oana Tabaranu
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Matt Raible
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Matt Raible
 
React.js alternatives modern web frameworks and lightweight java script libr...
React.js alternatives  modern web frameworks and lightweight java script libr...React.js alternatives  modern web frameworks and lightweight java script libr...
React.js alternatives modern web frameworks and lightweight java script libr...Katy Slemon
 
Get Hip with JHipster - Denver JUG 2015
Get Hip with JHipster - Denver JUG 2015Get Hip with JHipster - Denver JUG 2015
Get Hip with JHipster - Denver JUG 2015Matt Raible
 
Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlightsdswork
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013Alexandre Morgaut
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptAndrew Lovett-Barron
 
10 Years of JavaScript
10 Years of JavaScript10 Years of JavaScript
10 Years of JavaScriptMike de Boer
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Matt Raible
 
JavaScript on the server - Node.js
JavaScript on the server - Node.jsJavaScript on the server - Node.js
JavaScript on the server - Node.jsRody Middelkoop
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfJAX London
 

Similaire à Drupal Backbone.js in the Frontend (20)

Organized web app development using backbone.js
Organized web app development using backbone.jsOrganized web app development using backbone.js
Organized web app development using backbone.js
 
JavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right ChoiceJavaScript MV* Framework - Making the Right Choice
JavaScript MV* Framework - Making the Right Choice
 
LA RubyConf 2009 Waves And Resource-Oriented Architecture
LA RubyConf 2009 Waves And Resource-Oriented ArchitectureLA RubyConf 2009 Waves And Resource-Oriented Architecture
LA RubyConf 2009 Waves And Resource-Oriented Architecture
 
Node.JS briefly introduced
Node.JS briefly introducedNode.JS briefly introduced
Node.JS briefly introduced
 
Daniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDaniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého Schizma
 
FrontEnd-Roadmap.pdf
FrontEnd-Roadmap.pdfFrontEnd-Roadmap.pdf
FrontEnd-Roadmap.pdf
 
SXSW 2012 JavaScript MythBusters
SXSW 2012 JavaScript MythBustersSXSW 2012 JavaScript MythBusters
SXSW 2012 JavaScript MythBusters
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
 
React.js alternatives modern web frameworks and lightweight java script libr...
React.js alternatives  modern web frameworks and lightweight java script libr...React.js alternatives  modern web frameworks and lightweight java script libr...
React.js alternatives modern web frameworks and lightweight java script libr...
 
BackEnd-Roadmap.pdf
BackEnd-Roadmap.pdfBackEnd-Roadmap.pdf
BackEnd-Roadmap.pdf
 
Get Hip with JHipster - Denver JUG 2015
Get Hip with JHipster - Denver JUG 2015Get Hip with JHipster - Denver JUG 2015
Get Hip with JHipster - Denver JUG 2015
 
Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlights
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate Javascript
 
10 Years of JavaScript
10 Years of JavaScript10 Years of JavaScript
10 Years of JavaScript
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
 
JavaScript on the server - Node.js
JavaScript on the server - Node.jsJavaScript on the server - Node.js
JavaScript on the server - Node.js
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
 

Dernier

Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sectoritnewsafrica
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...itnewsafrica
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 

Dernier (20)

Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 

Drupal Backbone.js in the Frontend

Notes de l'éditeur

  1. A little about me:I’m a Computer Science EngineerI’m Spanish but living in Finland.I’ve been working and contributing to Drupal for more than 3 yearsI’m working for #AberdeenCloud, the new way of hosting Drupal
  2. Why I’m here talking with you about JavaScript and Backbone.js ?Because Backbone fits into Drupal futureThe *Big picture* is this:In the Backend, Drupal 8 will support natively RESTful calls, and in the frontend Backbone takes care of the User Interface, consuming the JSON data and rendering the HTML.But before we start to get into details …
  3. Start with the demoI was thinking to demo you a really basic TODO app, but better, I will show you a full complex web application: the #AberdeenCloud web interface.
  4. We made the decision to build the interface with backbone and we don’t regret.It enforces you to follow healthy design patterns and has made our code much easier to maintainOur backend doesn’t render any HTML, it’s all in the frontend. For the end user this translates into an extremely better user experience: the interface reacts instantly. Forget about refreshing pagesIf Backbone has worked for us, I’m sure it can help you too in your next web app. Now let’s see how we have arrived to this point after a decade of web evolution
  5. Do you remember how it was building web pages in 2000 ? I can’t remember anymore, but JavaScript was used those annoying alerts, dialogs, or pop-ups, it’s normal that JavaScript got a bad reputation from those days.[Click]It was later on, about 2006 when we started to look JavaScript with different eyes, after Google released Gmail with a pure JavaScript interface. Whaa… you can do that with JavaScript ?jQuery 1.0 was released by that time, but still most of websites were using JavaScript for some basic things, copy – pasting some javascript snippets in their HTML.[Click]Now. 2012. Today many developers are using JavaScript for important tasks, and is sharing the heavy-lifting with the backend. Today we don’t add only couple of JavaScript snippets. Today it’s normal to build websites with dozens of javascript files, multiple 3rd party libraries, and it’s becoming normal to have teams of front-end developers only to work in the interface.
  6. Do you recognize this slogan? Whose slogan it is? Yeah, it is Java’s slogan. As you know Java has nothing to do with Javascript. They say that Java is to Javascript as Ham is to Hamster.Although they are totally different, JavaScript is becoming the run-everywherelanguage that Java wanted to be. If you think about it, JavaScript is the only language that is shared across all main browsers. There is a JavaScript interpreter almost in all operative systems, in mobile phones, tablets and soon even in your TVs.Javascript is here to stay for some time, so there are big benefits to program your frontend in JavaScriptWho programs in JavaScript? Who likes it? Who hates it ? XD
  7. This is a screenshot that shows the Top Languages hosted on Github, number 1, JavaScriptJavaScript is growing in other ways too …
  8. This graph represents the last 2 years of evolution among the top 1 million sites in the Alexa Ranking.As you can see, the average JavaScript size nowadays has increased a lot.Further proof that we are no longer talking about “sugar” Javascript. We keep adding more and more logic to our frontend.If we keep doing that, without applying design patterns. Do you know how it’s going to end up ?
  9. If we are going to take JavaScript seriously.. we need to organize this mess and apply some structure.Some people says “Ah… PHP makes spaghetti code”. They don’t have a clue.That’s *nothing* compared to JavaScript: Asynchronous callbacks that triggers other callbacks that triggers other callbacks… the “Callback hell” . You know what I’m talking about if you have been there.We want the end of Spaguetti code (click)
  10. Yes, Lasagna code.I really mean it in a positive way.JavaScript in layers, modular encapsulated code, decoupled code easy to test. All those best practices that YOU already know, but we haven’t stopped to think about applying them to JavaScript.In my point of view, this is the main benefit of using Backbone
  11. So here is where Backbone enters.Jeremy Ashkenas is the author of Backbone, underscore.js and CoffeScriptBackbone depends on underscore.js and jQuery. Hey, hey!, jQuery, I know jQuery and it’s part of Drupal core.Why use Backbone if we have already jQuery? Well, they are not the same…
  12. Please pay attention now, these are important concepts:When people talk about “Javascript”, in general is a mix of these concepts[Click]So jQuery covers basically the DOM and Ajax. It makes a *great work* abstracting the DOM Api across all browsers and makes Ajax request easy as you know.But here is the secret: The less that you use the DOM, the better. DOM is the big bottleneck nowadays in the frontend.Most of the improvements in JavaScript speed in modern browsers during the last years are about EcmaScript Interpreters, Nowadays there are really fast.Backbone is a library that decouples your pure data from the DOM and Backbone helps you to keep things in the “Fast” side, touching as little as possible the DOM.It will make your app faster and your code cleaner.
  13. A Model in Backbone is just a JavaScript Object with some extra methods to basically fetch and save data to the serverImagine that the model asks from the server new data and when it has received, the Model triggers an event ‘hey, everyone!, I’ve changed’The view, that is listening to that event, takes care of updating the HTML: You don’t touch directly the DOMBackbone aims for a total separation of data and UI, not like other Javascript MVC frameworks.If there is something that you should remember of this session is this:The update of DOM, it’s a *consequence* of a change in a model. You should never need to manipulate directly the DOM yourself
  14. Jeremy released Backbone about two years ago[Click]Since then many other similar frameworks have pop out adopting ideas from Backbone.jsI know that is difficult to choose between JavaScript frameworks, but I would share with you my opinion…
  15. Backbone was the first. It is today more popular than any other MVC framework. What does it mean?More tutorials, more blog posts, more stack-overflow questions. We are in a sweet spot for developers.It’s small and flexible, only 800 LOCThe other frameworks are good too, I encourage you to review them and compare the small differences between them.The problem here is that applying design patterns to JavaScript apps is something relatively new, so you need all the support that you can at the beginning to start to figure out how it works.Why Backbone will continue leading for more years ? Because its philosophy (click)
  16. Backbone Philosophy: Focus on beingsmall and doing 1 thing really well.When it’s small it’s easy to adapt it to your needs, it’s server Agnostic, so it’s easy to adapt it to the LAMP Drupal stackThe author, Jeremy is very concerned of not bloating the library. New features are only added if they help to 80% or more of Backbone users. And if you don’t like something, just override it
  17. Did you hear what I said before ? 800 LOCCompare it with jQuery: More than 6.000 locSo it’s quite small. That’s good and bad.So here is the truth: Backbone is not doing much coding for you, it only provides you minimalistic tools “to build your app in a modular way”. It gives you a basic skeleton for structuring your codeYou need to understand how Backbone works to expand it and grow a complex web app. That’s why I talked a lot about JavaScript language during this session. If you are building Backbone application, you need to know about Javascript arrays, objects, scopes, closures, prototypes, all that stuff if you want to take the full power of Backbone.But don’t be worried . I’m coming from a PHP-Drupal background myself, so if I could learn it , you can do it too. Take it as a chance to learn JavaScript.
  18. Don’t complicate your life. To make a couple of Ajax calls, you don’t need BackboneRemember when I said that JavaScript is everywhere? Well that was a lie. One place where has not arrived is to Google bots, so if for you it’s important that content is fetched by Google, then don’t use JavaScript to render content.Backbone-way takes time to learn. Prepare at least couple of weeks to fully understand it.. But anyway we, Drupal developers, are used to steep learning curves, so I’m sure you won’t have any problems.Don’t use compilers like Coffeescript until you master JavaScript.And in the same way, there are some add-ons that they promise you to make easier your life, but probably you don’t need them and they will bloat your app.Don’t waste time trying to understand it by theory. It’s a (Model View Whatever) framework. The best advice I can give you is read the source code, those 800 LOC, if you really want to grasp it.
  19. I understand that it can create tension between back-end and front-end developers.Or if you are working in both ends, it can create a conflict inside you deciding Should I put the hat of “JavaScript developer” or the hat of “PHP developer”But you must choose one hat, and do it with that language.What I mean is…
  20. In Drupal 6 core we started to program JavaScript *from* PHP.If you have worked with “ahah” properties, you know that they were a pain.This is called meta-programming, and we are doubling the complexity of our code when we do things like this[Click]In Drupal 7 we have more metaprogramming. This kind of things were done with best intentions, and is suitable for really simple stuff and not obtrusive behavior. But we are in 2012 and this little sandbox is not enough
  21. So that was my little rant.Please don’t do meta-programming any more in Drupal 8I would like to finish my slides, with this idea: Embrace JavaScript. And when you put your hat of JavaScript developer, do it with JavaScript languageDon’t feel bad “oh noes, I’m not doing it the Drupal way”, because Drupal way is also changing.Thanks to Larry Gardfield and his WSCCI initiative, we will have Drupal 8 exposing content in a native RESTfulJSONway. And still PHP & Drupal are very important in this paradigm, still we need authentication, storingthe actual content, the validation, the permissions, the emailing system, etc.Backbone just liberates the server from some pure-client-tasks.
  22. I will tweet a link to the extended version of my slides later todayBut now let’s listen to Ethan, coming from United States to share with us his work on the Backbone Module and how to make web apps with Drupal 7.Thank you