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

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
 

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
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
 
PPT
Top java script frameworks ppt
Omkarsoft Bangalore
 
Developing Backbonejs Applications Early Release Addy Osmani
littelenkali
 
Developing Backbone js Applications Addy Osmani
leitaduminy
 
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
 
Top java script frameworks ppt
Omkarsoft Bangalore
 
Ad

Recently uploaded (20)

PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Digital Circuits, important subject in CS
contactparinay1
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 

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.