SlideShare a Scribd company logo
1 of 26
Download to read offline
Developing large scale
JavaScript applications
       Milan Korsos, @korsosm
    Front End Developer, SoWink Inc
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.
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
Thanks.




We make it ridiculously easy to meet new people offline.

More Related Content

What's hot

One step in the future: CSS variables
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variablesGiacomo Zinetti
 
Webpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSWebpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSEmil Öberg
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript TestingScott Becker
 
webpack 101 slides
webpack 101 slideswebpack 101 slides
webpack 101 slidesmattysmith
 
Workshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCWorkshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCVisual Engineering
 
PHP MVC Tutorial
PHP MVC TutorialPHP MVC Tutorial
PHP MVC TutorialYang Bruce
 
React Facebook JavaScript Library
React Facebook JavaScript LibraryReact Facebook JavaScript Library
React Facebook JavaScript LibraryTakami Kazuya
 
JavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & BrowserifyJavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & BrowserifyJohan Nilsson
 
Packing for the Web with Webpack
Packing for the Web with WebpackPacking for the Web with Webpack
Packing for the Web with WebpackThiago Temple
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSSimon Guest
 
Service Worker 201 (en)
Service Worker 201 (en)Service Worker 201 (en)
Service Worker 201 (en)Chang W. Doh
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web ComponentsAndrew Rota
 
Requirejs
RequirejsRequirejs
Requirejssioked
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS偉格 高
 
Principles of MVC for PHP Developers
Principles of MVC for PHP DevelopersPrinciples of MVC for PHP Developers
Principles of MVC for PHP DevelopersEdureka!
 
JavaScript: DOM and jQuery
JavaScript: DOM and jQueryJavaScript: DOM and jQuery
JavaScript: DOM and jQuery維佋 唐
 

What's hot (20)

One step in the future: CSS variables
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variables
 
React
React React
React
 
Webpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JSWebpack Tutorial, Uppsala JS
Webpack Tutorial, Uppsala JS
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
 
webpack 101 slides
webpack 101 slideswebpack 101 slides
webpack 101 slides
 
Workshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCWorkshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVC
 
PHP MVC Tutorial
PHP MVC TutorialPHP MVC Tutorial
PHP MVC Tutorial
 
React Facebook JavaScript Library
React Facebook JavaScript LibraryReact Facebook JavaScript Library
React Facebook JavaScript Library
 
JavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & BrowserifyJavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & Browserify
 
Packing for the Web with Webpack
Packing for the Web with WebpackPacking for the Web with Webpack
Packing for the Web with Webpack
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
 
Service Worker 201 (en)
Service Worker 201 (en)Service Worker 201 (en)
Service Worker 201 (en)
 
Webdriver.io
Webdriver.io Webdriver.io
Webdriver.io
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Requirejs
RequirejsRequirejs
Requirejs
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
Principles of MVC for PHP Developers
Principles of MVC for PHP DevelopersPrinciples of MVC for PHP Developers
Principles of MVC for PHP Developers
 
JavaScript: DOM and jQuery
JavaScript: DOM and jQueryJavaScript: DOM and jQuery
JavaScript: DOM and jQuery
 
Dan Webb Presentation
Dan Webb PresentationDan Webb Presentation
Dan Webb Presentation
 

Viewers also liked

Inside Wijmo 5, a Large-scale JavaScript Product
Inside Wijmo 5, a Large-scale JavaScript ProductInside Wijmo 5, a Large-scale JavaScript Product
Inside Wijmo 5, a Large-scale JavaScript ProductChris Bannon
 
5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScriptNael El Shawwa
 
Javascript Everywhere From Nose To Tail
Javascript Everywhere From Nose To TailJavascript Everywhere From Nose To Tail
Javascript Everywhere From Nose To TailCliffano Subagio
 
Using Node.js for everything or what it is to write a book about it
Using Node.js for everything or what it is to write a book about itUsing Node.js for everything or what it is to write a book about it
Using Node.js for everything or what it is to write a book about itKrasimir Tsonev
 
jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture Jiby John
 
Reactjs - the good, the bad and the ugly
Reactjs - the good, the bad and the uglyReactjs - the good, the bad and the ugly
Reactjs - the good, the bad and the uglyKrasimir Tsonev
 
Unidirectional data flow
Unidirectional data flowUnidirectional data flow
Unidirectional data flowDenis Gorbunov
 
Building Large Scale Javascript Application
Building Large Scale Javascript ApplicationBuilding Large Scale Javascript Application
Building Large Scale Javascript ApplicationAnis Ahmad
 
Large-Scale JavaScript Development
Large-Scale JavaScript DevelopmentLarge-Scale JavaScript Development
Large-Scale JavaScript DevelopmentAddy Osmani
 

Viewers also liked (10)

Inside Wijmo 5, a Large-scale JavaScript Product
Inside Wijmo 5, a Large-scale JavaScript ProductInside Wijmo 5, a Large-scale JavaScript Product
Inside Wijmo 5, a Large-scale JavaScript Product
 
5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript
 
Javascript Everywhere From Nose To Tail
Javascript Everywhere From Nose To TailJavascript Everywhere From Nose To Tail
Javascript Everywhere From Nose To Tail
 
Using Node.js for everything or what it is to write a book about it
Using Node.js for everything or what it is to write a book about itUsing Node.js for everything or what it is to write a book about it
Using Node.js for everything or what it is to write a book about it
 
jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture
 
Reactjs - the good, the bad and the ugly
Reactjs - the good, the bad and the uglyReactjs - the good, the bad and the ugly
Reactjs - the good, the bad and the ugly
 
Unidirectional data flow
Unidirectional data flowUnidirectional data flow
Unidirectional data flow
 
Building Large Scale Javascript Application
Building Large Scale Javascript ApplicationBuilding Large Scale Javascript Application
Building Large Scale Javascript Application
 
Large-Scale JavaScript Development
Large-Scale JavaScript DevelopmentLarge-Scale JavaScript Development
Large-Scale JavaScript Development
 
Modern Web Applications
Modern Web ApplicationsModern Web Applications
Modern Web Applications
 

Similar to Developing large scale JavaScript applications

Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatiasapientindia
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]GDSC UofT Mississauga
 
Александр Белецкий "Архитектура Javascript приложений"
 Александр Белецкий "Архитектура Javascript приложений" Александр Белецкий "Архитектура Javascript приложений"
Александр Белецкий "Архитектура Javascript приложений"Agile Base Camp
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQueryAnil Kumar
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Previewvaluebound
 
KnockOutjs from Scratch
KnockOutjs from ScratchKnockOutjs from Scratch
KnockOutjs from ScratchUdaya Kumar
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsVolodymyr Voytyshyn
 
jquery summit presentation for large scale javascript applications
jquery summit  presentation for large scale javascript applicationsjquery summit  presentation for large scale javascript applications
jquery summit presentation for large scale javascript applicationsDivyanshGupta922023
 
Building Scalable JavaScript Apps
Building Scalable JavaScript AppsBuilding Scalable JavaScript Apps
Building Scalable JavaScript AppsGil Fink
 
AngularJS Beginner Day One
AngularJS Beginner Day OneAngularJS Beginner Day One
AngularJS Beginner Day OneTroy Miles
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsclimboid
 
Introduction To MVVM
Introduction To MVVMIntroduction To MVVM
Introduction To MVVMBoulos Dib
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular jsAayush Shrestha
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web ApplicationYakov Fain
 
Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.jsBert Wijnants
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day trainingTroy Miles
 

Similar to Developing large scale JavaScript applications (20)

Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
Александр Белецкий "Архитектура Javascript приложений"
 Александр Белецкий "Архитектура Javascript приложений" Александр Белецкий "Архитектура Javascript приложений"
Александр Белецкий "Архитектура Javascript приложений"
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
 
Starting with jQuery
Starting with jQueryStarting with jQuery
Starting with jQuery
 
Fundaments of Knockout js
Fundaments of Knockout jsFundaments of Knockout js
Fundaments of Knockout js
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
KnockOutjs from Scratch
KnockOutjs from ScratchKnockOutjs from Scratch
KnockOutjs from Scratch
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design Patterns
 
jquery summit presentation for large scale javascript applications
jquery summit  presentation for large scale javascript applicationsjquery summit  presentation for large scale javascript applications
jquery summit presentation for large scale javascript applications
 
Building Scalable JavaScript Apps
Building Scalable JavaScript AppsBuilding Scalable JavaScript Apps
Building Scalable JavaScript Apps
 
AngularJS Beginner Day One
AngularJS Beginner Day OneAngularJS Beginner Day One
AngularJS Beginner Day One
 
Knockout in action
Knockout in actionKnockout in action
Knockout in action
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web apps
 
Introduction To MVVM
Introduction To MVVMIntroduction To MVVM
Introduction To MVVM
 
Struts 1
Struts 1Struts 1
Struts 1
 
Understanding angular js
Understanding angular jsUnderstanding angular js
Understanding angular js
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
Viking academy backbone.js
Viking academy  backbone.jsViking academy  backbone.js
Viking academy backbone.js
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 

Recently uploaded

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Recently uploaded (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Developing large scale JavaScript applications

  • 1. Developing large scale JavaScript applications Milan Korsos, @korsosm Front End Developer, SoWink Inc
  • 2.
  • 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
  • 21.
  • 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
  • 25.
  • 26. Thanks. We make it ridiculously easy to meet new people offline.