SlideShare a Scribd company logo
Developing large scale
JavaScript applications
       Milan Korsos, @korsosm
    Front End Developer, SoWink Inc
Developing large scale JavaScript applications
large scale JavaScript

non-trival applications
requiring significant developer effort to maintain,
where most heavy lifting data manipulation and
display falls to the browser
large scale JavaScript

‘The secret to building large apps is never build large apps.
Break your applications into small pieces. Then, assemble
those testable, bite-sized pieces into your big application.’
   Justin Meyer, author JavaScriptMVC
module

module theory: everything is a module
   credit: Nicholas Zakas (@slicknet)
   module is an independent unit of functionality
   that is a part of the total structure of a web application
module

any single module should be able to live on its own
loose coupling allows you to make changes to one module
without affecting the others
each module is like a puzzle piece
module

only call your own methods
don’t access DOM elements outside of your box
don’t access non-native global objects
don’t create global objects
don’t directly reference to other modules
module

we have a global object for our modules
   s = {};
   s.quickBrowseAppView = new QuickBrowseAppView();
module
Modules consist of HTML + JavaScript + CSS
   we use jQuery to simplify JavaScript
   we use jQuery plugins, but NOT jQuery UI
   we use Backbone.js for MVC structures
   we use Underscore.js for templating
   we use LESS to extend CSS w dynamic behavior
backbone.js

Model-View-Controller pattern
   separate the different aspects of the application (input
   logic, business logic, UI logic)
jQuery is a tool, but it doesn’t provide structure for the app
   Backbone.js provides an MVC like pattern
backbone.js
Models
   interactive data and the logic that surrounding it
Collections
   ordered set of models
Views
   listen events, reacts and render data models
backbone.js

Backbone is an event driven library
   a module that can be mixed in to any object, giving the
   object the ability to bind and trigger custom events
You can bind custom events to functions.
   collection.bind(‘changed’,view.render);
underscore.js

store the templates in the HTML file
      use variables <%= variable %>
      use loops or conditions <% if (condition) { %> <% } %>
always load the template only once!
More: http://gist.github.com/1329750
LESS

www.lesscss.org
LESS extends CSS with dynamic behavior such as
   variables
   operations
   functions
code quality

code review
pair programming
www.jshint.com
Never push code to master that breaks the site!
JavaScript: The Good Parts (Douglas Crockford)
hints
save ajax request
   get initial data on pageload
   buildFromDOM method
use RESTful API with JSON
   /api/v1/comment
   GET/PUT/POST/DELETE methods
hints
debugging
      never use alerts for debugging
      don’t use console.log(‘hello world’); for debugging
      define cookie controlled custom outputs for the modules
            quickbrowseConsole.log(‘hello world’)
More: http://gist.github.com/1391691
hints
don’t store ID’s in class names
   don’t do ugly things like this <p class=”comment-id-12”>
   use the HTML5 data attribute for this <p data-id=12>
minify the code before deployment
write javascript in strict mode
   performance, eliminate pitfalls, prep. for future versions
hints
write tests
   use Jasmine BDD and Sinon.JS for Backbone.js apps
   http://tinnedfruit.com/2011/03/03/testing-backbone-apps-with-jasmine-sinon.html


use $ as the first character in the variable name if the
variable contains a jQuery selector
define CONSTANTS at the top of the file
QuickBrowse case study


Profile browser feature.
Developing large scale JavaScript applications
QuickBrowse case study
Model: Profile
Collections:
   BufferItems
   UpcomingProfiles
   CurrentProfile
   VotedProfiles
QuickBrowse case study
Views:
   BufferProfilesView
   UpcomingProfilesView
   CurrentProfileView
   VotedProfilesView
   QuickBrowseAppView
QuickBrowse case study

Restriction
   Ask for new profiles in batches.
So we also need a downloading collection.
   LoadingProfiles
   LoadingProfilesView
Developing large scale JavaScript applications
Thanks.




We make it ridiculously easy to meet new people offline.

More Related Content

PDF
Backbone.js
Omnia Helmi
 
PPT
Js unit testing
Mihail Irintchev
 
PPTX
Backbone.js
VO Tho
 
PDF
Packing it all: JavaScript module bundling from 2000 to now
Derek Willian Stavis
 
PPTX
Testing frontends with nightwatch & saucelabs
Tudor Barbu
 
PDF
Building a js widget
Tudor Barbu
 
PDF
Building a Startup Stack with AngularJS
FITC
 
PDF
Javascript ui for rest services
Ioan Eugen Stan
 
Backbone.js
Omnia Helmi
 
Js unit testing
Mihail Irintchev
 
Backbone.js
VO Tho
 
Packing it all: JavaScript module bundling from 2000 to now
Derek Willian Stavis
 
Testing frontends with nightwatch & saucelabs
Tudor Barbu
 
Building a js widget
Tudor Barbu
 
Building a Startup Stack with AngularJS
FITC
 
Javascript ui for rest services
Ioan Eugen Stan
 

What's hot (20)

PDF
One step in the future: CSS variables
Giacomo Zinetti
 
PDF
React
중운 박
 
PDF
Webpack Tutorial, Uppsala JS
Emil Öberg
 
KEY
Agile JavaScript Testing
Scott Becker
 
PDF
webpack 101 slides
mattysmith
 
PDF
Workshop 9: BackboneJS y patrones MVC
Visual Engineering
 
PDF
PHP MVC Tutorial
Yang Bruce
 
PDF
React Facebook JavaScript Library
Takami Kazuya
 
PDF
JavaScript Dependencies, Modules & Browserify
Johan Nilsson
 
PPTX
Packing for the Web with Webpack
Thiago Temple
 
PDF
Introduction to AngularJS
Jussi Pohjolainen
 
PDF
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
PDF
Service Worker 201 (en)
Chang W. Doh
 
PDF
Webdriver.io
LinkMe Srl
 
PDF
The Complementarity of React and Web Components
Andrew Rota
 
KEY
Requirejs
sioked
 
PDF
Module, AMD, RequireJS
偉格 高
 
PDF
Principles of MVC for PHP Developers
Edureka!
 
PDF
JavaScript: DOM and jQuery
維佋 唐
 
PDF
Dan Webb Presentation
RubyOnRails_dude
 
One step in the future: CSS variables
Giacomo Zinetti
 
React
중운 박
 
Webpack Tutorial, Uppsala JS
Emil Öberg
 
Agile JavaScript Testing
Scott Becker
 
webpack 101 slides
mattysmith
 
Workshop 9: BackboneJS y patrones MVC
Visual Engineering
 
PHP MVC Tutorial
Yang Bruce
 
React Facebook JavaScript Library
Takami Kazuya
 
JavaScript Dependencies, Modules & Browserify
Johan Nilsson
 
Packing for the Web with Webpack
Thiago Temple
 
Introduction to AngularJS
Jussi Pohjolainen
 
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
Service Worker 201 (en)
Chang W. Doh
 
Webdriver.io
LinkMe Srl
 
The Complementarity of React and Web Components
Andrew Rota
 
Requirejs
sioked
 
Module, AMD, RequireJS
偉格 高
 
Principles of MVC for PHP Developers
Edureka!
 
JavaScript: DOM and jQuery
維佋 唐
 
Dan Webb Presentation
RubyOnRails_dude
 
Ad

Viewers also liked (10)

PPTX
Inside Wijmo 5, a Large-scale JavaScript Product
Chris Bannon
 
KEY
5 Tips for Writing Better JavaScript
Nael El Shawwa
 
ZIP
Javascript Everywhere From Nose To Tail
Cliffano Subagio
 
PDF
Using Node.js for everything or what it is to write a book about it
Krasimir Tsonev
 
PDF
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
PDF
Reactjs - the good, the bad and the ugly
Krasimir Tsonev
 
PPTX
Unidirectional data flow
Denis Gorbunov
 
PDF
Building Large Scale Javascript Application
Anis Ahmad
 
PDF
Large-Scale JavaScript Development
Addy Osmani
 
PDF
Modern Web Applications
Ömer Göktuğ Poyraz
 
Inside Wijmo 5, a Large-scale JavaScript Product
Chris Bannon
 
5 Tips for Writing Better JavaScript
Nael El Shawwa
 
Javascript Everywhere From Nose To Tail
Cliffano Subagio
 
Using Node.js for everything or what it is to write a book about it
Krasimir Tsonev
 
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
Reactjs - the good, the bad and the ugly
Krasimir Tsonev
 
Unidirectional data flow
Denis Gorbunov
 
Building Large Scale Javascript Application
Anis Ahmad
 
Large-Scale JavaScript Development
Addy Osmani
 
Modern Web Applications
Ömer Göktuğ Poyraz
 
Ad

Similar to Developing large scale JavaScript applications (20)

PDF
Developing Backbonejs Applications Early Release Addy Osmani
littelenkali
 
PDF
Developing Backbone js Applications Addy Osmani
leitaduminy
 
PDF
Developing Backbone js Applications Addy Osmani
stegzdf6784
 
PDF
Instant download Developing Backbone js Applications Addy Osmani pdf all chapter
dinetvenitja
 
PPSX
Introduction to backbone_js
Mohammed Saqib
 
KEY
Single Page Applications - Desert Code Camp 2012
Adam Mokan
 
PDF
Rp 6 session 2 naresh bhatia
sapientindia
 
PPTX
Large-Scale Web Development with JavaScript
Navid Ahmadi
 
PDF
Intro to BackboneJS + Intermediate Javascript
Andrew Lovett-Barron
 
PDF
Backbone.js slides
Ambert Ho
 
PPTX
JS Frameworks - Angular Vs Backbone
Gourav Jain, MCTS®
 
PPTX
Javascript for Wep Apps
Michael Puckett
 
PPTX
MVC & backbone.js
Mohammed Arif
 
PPTX
BackboneJS Training - Giving Backbone to your applications
Joseph Khan
 
PPT
Intro to-html-backbone
zonathen
 
PPTX
Backbonejs for beginners
Divakar Gu
 
PPTX
Drupal Backbone.js in the Frontend
David Corbacho Román
 
KEY
Give Your JavaScript Apps Some Spine
Lachlan Hardy
 
PPTX
Organized web app development using backbone.js
Shakti Shrestha
 
PPTX
BackboneJS
Artemii Kravtsov
 
Developing Backbonejs Applications Early Release Addy Osmani
littelenkali
 
Developing Backbone js Applications Addy Osmani
leitaduminy
 
Developing Backbone js Applications Addy Osmani
stegzdf6784
 
Instant download Developing Backbone js Applications Addy Osmani pdf all chapter
dinetvenitja
 
Introduction to backbone_js
Mohammed Saqib
 
Single Page Applications - Desert Code Camp 2012
Adam Mokan
 
Rp 6 session 2 naresh bhatia
sapientindia
 
Large-Scale Web Development with JavaScript
Navid Ahmadi
 
Intro to BackboneJS + Intermediate Javascript
Andrew Lovett-Barron
 
Backbone.js slides
Ambert Ho
 
JS Frameworks - Angular Vs Backbone
Gourav Jain, MCTS®
 
Javascript for Wep Apps
Michael Puckett
 
MVC & backbone.js
Mohammed Arif
 
BackboneJS Training - Giving Backbone to your applications
Joseph Khan
 
Intro to-html-backbone
zonathen
 
Backbonejs for beginners
Divakar Gu
 
Drupal Backbone.js in the Frontend
David Corbacho Román
 
Give Your JavaScript Apps Some Spine
Lachlan Hardy
 
Organized web app development using backbone.js
Shakti Shrestha
 
BackboneJS
Artemii Kravtsov
 

Recently uploaded (20)

PDF
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Why Your AI & Cybersecurity Hiring Still Misses the Mark in 2025
Virtual Employee Pvt. Ltd.
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Software Development Company | KodekX
KodekX
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
This slide provides an overview Technology
mineshkharadi333
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 

Developing large scale JavaScript applications

  • 1. Developing large scale JavaScript applications Milan Korsos, @korsosm Front End Developer, SoWink Inc
  • 3. large scale JavaScript non-trival applications requiring significant developer effort to maintain, where most heavy lifting data manipulation and display falls to the browser
  • 4. large scale JavaScript ‘The secret to building large apps is never build large apps. Break your applications into small pieces. Then, assemble those testable, bite-sized pieces into your big application.’ Justin Meyer, author JavaScriptMVC
  • 5. module module theory: everything is a module credit: Nicholas Zakas (@slicknet) module is an independent unit of functionality that is a part of the total structure of a web application
  • 6. module any single module should be able to live on its own loose coupling allows you to make changes to one module without affecting the others each module is like a puzzle piece
  • 7. module only call your own methods don’t access DOM elements outside of your box don’t access non-native global objects don’t create global objects don’t directly reference to other modules
  • 8. module we have a global object for our modules s = {}; s.quickBrowseAppView = new QuickBrowseAppView();
  • 9. module Modules consist of HTML + JavaScript + CSS we use jQuery to simplify JavaScript we use jQuery plugins, but NOT jQuery UI we use Backbone.js for MVC structures we use Underscore.js for templating we use LESS to extend CSS w dynamic behavior
  • 10. backbone.js Model-View-Controller pattern separate the different aspects of the application (input logic, business logic, UI logic) jQuery is a tool, but it doesn’t provide structure for the app Backbone.js provides an MVC like pattern
  • 11. backbone.js Models interactive data and the logic that surrounding it Collections ordered set of models Views listen events, reacts and render data models
  • 12. backbone.js Backbone is an event driven library a module that can be mixed in to any object, giving the object the ability to bind and trigger custom events You can bind custom events to functions. collection.bind(‘changed’,view.render);
  • 13. underscore.js store the templates in the HTML file use variables <%= variable %> use loops or conditions <% if (condition) { %> <% } %> always load the template only once! More: http://gist.github.com/1329750
  • 14. LESS www.lesscss.org LESS extends CSS with dynamic behavior such as variables operations functions
  • 15. code quality code review pair programming www.jshint.com Never push code to master that breaks the site! JavaScript: The Good Parts (Douglas Crockford)
  • 16. hints save ajax request get initial data on pageload buildFromDOM method use RESTful API with JSON /api/v1/comment GET/PUT/POST/DELETE methods
  • 17. hints debugging never use alerts for debugging don’t use console.log(‘hello world’); for debugging define cookie controlled custom outputs for the modules quickbrowseConsole.log(‘hello world’) More: http://gist.github.com/1391691
  • 18. hints don’t store ID’s in class names don’t do ugly things like this <p class=”comment-id-12”> use the HTML5 data attribute for this <p data-id=12> minify the code before deployment write javascript in strict mode performance, eliminate pitfalls, prep. for future versions
  • 19. hints write tests use Jasmine BDD and Sinon.JS for Backbone.js apps http://tinnedfruit.com/2011/03/03/testing-backbone-apps-with-jasmine-sinon.html use $ as the first character in the variable name if the variable contains a jQuery selector define CONSTANTS at the top of the file
  • 22. QuickBrowse case study Model: Profile Collections: BufferItems UpcomingProfiles CurrentProfile VotedProfiles
  • 23. QuickBrowse case study Views: BufferProfilesView UpcomingProfilesView CurrentProfileView VotedProfilesView QuickBrowseAppView
  • 24. QuickBrowse case study Restriction Ask for new profiles in batches. So we also need a downloading collection. LoadingProfiles LoadingProfilesView
  • 26. Thanks. We make it ridiculously easy to meet new people offline.