SlideShare a Scribd company logo
1 of 24
Large-Scale Web Development
with JavaScript
Navid Ahmadi
Ph.D. in Computer Science
October 30, 2013
MVC
Data Model
View
– Template

Controller
View Model
Binder (Observer)
Router
REST
JSON
Web Software Architectures
DB

DB

Controllers, Routers,
Model, UI Templates

Data management
Authentication

Server
Client

User Input,
Events

Data

Generated UI

Model, View,
Controllers, User input
and Event Handling

UI Styling, Validation

•
•
•
•

Rails, .NET MVC,…
Thin client
More Secure
Web Pages

•
•
•
•

Backbone, Angular, …
Thick client
Rich and Responsive
Web applications

Data
JS challenges
JS apps get cluttered quickly
– Missing organization
– Over 2K lines are hard to manage
– No support for modules, packages, namespaces

Dynamic language

1. MVC

2. TypeScript

– No static type checking, No Refactoring tools
– Variable scopes are not clear
– Software fails at runtime

Build and deploy
– Minification and obfuscation should be done explicitly
– Hard to create builds based on configurations

3. AMD
Client-side MVC in JavaScript
View
(HTML Template)

Loads into DOM

Controller

Sends user actions
Updates the DOM

Creates the Binder

Updates the Model
(triggered by the user
or the system)

Binder
(observer)
Sends Updates
Data Model

Client

(observable)

Server

Routes

Rest of the
Software
JS-based MVC Libraries

http://todomvc.com/
Backbone.js
http://backbonejs.org/
Used in Groupon Now!, Hulu, Delicious, Khan Academy,
Foursquare,…

Main concepts
–
–
–
–

Model
Collection
View
Router
Backbone Model*

* Available at http://backbonetutorials.com/
Extending a Model
Observing the changes in the Model

Observable
Binding the Model to the REST API

POST /user : Server returns the ‘id’
Retrieving Model’s data from the Server
GET /user/1
Update/Delete from the Server

PUT /user/1

DELETE /user/1
Backbone Collection
Backbone View
Connecting the View to the Model*

* http://stackoverflow.com/questions/5651629/backbone-js-collections-and-views/5656433#5656433
Backbone Router
Backbone Pros and Cons
Pros
–
–
–
–

Tied to Underscore.js
Lightweight (6K V1.1.0)
Very flexible
Works offline
• Using LocalStorage
• Optimistic since V0.9

Cons
– Verbose (e.g., GPL vs DSL)
– REST-oriented
Asynchronous Module Definition
AMD
–
–
–
–

http://requirejs.org/
Allows creating packages, modules, and dependencies
Automatically backed by a minifier (Closure compiler, Uglify)
Cons: Does not allow circular dependencies

has.js
– https://github.com/phiggins42/has.js/
– Feature detection
– build configuration
• Dead code removal by Closure Compiler
TypeScript
Superset of JavaScript
– Compiler (.ts => .js)
– Open-source

Language features:
–
–
–
–

Static Type Checking
Interfaces
Classical Inheritance
Generics

http://www.typescriptlang.org

Microsoft Visual Studio Plugin
– Intellisense
– Refactoring (e.g., variable renaming)
Other MV* solutions
Angular: MVW
– Complete development framework
– Two-way binding of View and Model
– Increases development speed
• 5K lines backbone app reported to become 750 lines

– Opinionated

Knockout
– KO.Observable()

Explore www.todomvc.com
Other goodies
Git, Github, Bitbucket
Responsive Design
– Bootstrap

Glyph Icons, FontAwesome
NoSQL Databases
– MongoDB

Server-side JS
– Node.js

CSS frameworks
– LESS, Blueprint,…

Real-time apps
– Meteor, Derby, Firebase, Pusher

Continuous Integration, Test-driven design
– Buster, Jasmine, TestSwarm
Conclusions
Build large-scale Web applications with
– MVC (Code Organization, Separation of Concerns)
– AMD (Code Organization, Easy Deployment)
– TypeScript (Static Type Checking)

JS dev has been revolutionized in the last 5 years
– Stay updated with the newest technologies
– Consider integrating new tools into your projects
– Consider migrating your existing projects!
About Me

http://www.linkedin.com/in/nahmadi
navid.ai@gmail.com

ASP.NET developer in 2002-2005
When C# was still in beta!
Got into JavaScript development in 2006
2007-08: Created a Game Engine and Compiler
– JS + Canvas
Agent
– 4K LOC
Gallery

Agent
Gallery

Depiction
Editor

2009-11: Created an Online Game Design Environment
Depiction
– Front-end: JS + Dojo; Backend: Drupal + Nginx
Editor
– 15+K LOC

UX design for novice users
– Game level editor
– Visual Programming Language

Conditions

Programming Environment

Actions

More Related Content

What's hot

What's hot (20)

Introduction to Ember.js
Introduction to Ember.jsIntroduction to Ember.js
Introduction to Ember.js
 
Mar 16 report
Mar 16 reportMar 16 report
Mar 16 report
 
React js Introduction
React js IntroductionReact js Introduction
React js Introduction
 
WPF Meets Applications
WPF Meets ApplicationsWPF Meets Applications
WPF Meets Applications
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
 
Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016
 
Angular js gtg-27feb2013
Angular js gtg-27feb2013Angular js gtg-27feb2013
Angular js gtg-27feb2013
 
Mvc fundamental
Mvc fundamentalMvc fundamental
Mvc fundamental
 
Vertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UG
Vertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UGVertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UG
Vertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UG
 
Evaluation and prototyping of an HTML5 Client for iOS devices
Evaluation and prototyping of an HTML5 Client for iOS devicesEvaluation and prototyping of an HTML5 Client for iOS devices
Evaluation and prototyping of an HTML5 Client for iOS devices
 
Ranjith_Reddy Yallampalli Resume
Ranjith_Reddy Yallampalli ResumeRanjith_Reddy Yallampalli Resume
Ranjith_Reddy Yallampalli Resume
 
Cv kapil
Cv kapilCv kapil
Cv kapil
 
JavaCro'15 - Web UI best practice integration with Java EE 7 - Peter Lehto
JavaCro'15 - Web UI best practice integration with Java EE 7 - Peter LehtoJavaCro'15 - Web UI best practice integration with Java EE 7 - Peter Lehto
JavaCro'15 - Web UI best practice integration with Java EE 7 - Peter Lehto
 
JAVA EE training from 3rd-oct-2015
JAVA EE training from 3rd-oct-2015JAVA EE training from 3rd-oct-2015
JAVA EE training from 3rd-oct-2015
 
Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
 
Santosh_Resume_Java
Santosh_Resume_JavaSantosh_Resume_Java
Santosh_Resume_Java
 
JavaME UI - JMDF 2007
JavaME UI - JMDF 2007JavaME UI - JMDF 2007
JavaME UI - JMDF 2007
 
iOS Architectures
iOS ArchitecturesiOS Architectures
iOS Architectures
 
Cqrs intro
Cqrs introCqrs intro
Cqrs intro
 
Berlin.JAR: Web future without web frameworks
Berlin.JAR: Web future without web frameworksBerlin.JAR: Web future without web frameworks
Berlin.JAR: Web future without web frameworks
 

Similar to Large-Scale Web Development with JavaScript

Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Jeremy Likness
 
Mobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best PracticesMobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best Practices
Andrew Ferrier
 
Javascript library toolbox
Javascript library toolboxJavascript library toolbox
Javascript library toolbox
Skysoul Pty.Ltd.
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
Introduction to web application development with Vue (for absolute beginners)...
Introduction to web application development with Vue (for absolute beginners)...Introduction to web application development with Vue (for absolute beginners)...
Introduction to web application development with Vue (for absolute beginners)...
Lucas Jellema
 
Software Development Practices.pdf
Software Development Practices.pdfSoftware Development Practices.pdf
Software Development Practices.pdf
Ezhumalai p
 

Similar to Large-Scale Web Development with JavaScript (20)

Introduction to Visual studio 2012
Introduction to Visual studio 2012 Introduction to Visual studio 2012
Introduction to Visual studio 2012
 
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
Wintellect - Devscovery - Enterprise JavaScript Development 2 of 2
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
Mobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best PracticesMobile and IBM Worklight Best Practices
Mobile and IBM Worklight Best Practices
 
Javascript library toolbox
Javascript library toolboxJavascript library toolbox
Javascript library toolbox
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 
A164 enterprise javascript ibm node sdk
A164 enterprise javascript ibm node sdkA164 enterprise javascript ibm node sdk
A164 enterprise javascript ibm node sdk
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5What's new in Portal and WCM 8.5
What's new in Portal and WCM 8.5
 
Social Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech DaySocial Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech Day
 
Introduction to web application development with Vue (for absolute beginners)...
Introduction to web application development with Vue (for absolute beginners)...Introduction to web application development with Vue (for absolute beginners)...
Introduction to web application development with Vue (for absolute beginners)...
 
Gwt Deep Dive
Gwt Deep DiveGwt Deep Dive
Gwt Deep Dive
 
Software Development Practices.pdf
Software Development Practices.pdfSoftware Development Practices.pdf
Software Development Practices.pdf
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - Introduction
 
Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)Going offline with JS (DDD Sydney)
Going offline with JS (DDD Sydney)
 
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav TulachJDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
JDD2015: Java Everywhere Again—with DukeScript - Jaroslav Tulach
 
Lecture 05 web_applicationframeworks
Lecture 05 web_applicationframeworksLecture 05 web_applicationframeworks
Lecture 05 web_applicationframeworks
 
MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!MV* presentation frameworks in Javascript: en garde, pret, allez!
MV* presentation frameworks in Javascript: en garde, pret, allez!
 
Ci selenium
Ci seleniumCi selenium
Ci selenium
 
Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)Google App Engine overview (GAE/J)
Google App Engine overview (GAE/J)
 

Recently uploaded

Recently uploaded (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Large-Scale Web Development with JavaScript

  • 1. Large-Scale Web Development with JavaScript Navid Ahmadi Ph.D. in Computer Science October 30, 2013
  • 2. MVC Data Model View – Template Controller View Model Binder (Observer) Router REST JSON
  • 3. Web Software Architectures DB DB Controllers, Routers, Model, UI Templates Data management Authentication Server Client User Input, Events Data Generated UI Model, View, Controllers, User input and Event Handling UI Styling, Validation • • • • Rails, .NET MVC,… Thin client More Secure Web Pages • • • • Backbone, Angular, … Thick client Rich and Responsive Web applications Data
  • 4. JS challenges JS apps get cluttered quickly – Missing organization – Over 2K lines are hard to manage – No support for modules, packages, namespaces Dynamic language 1. MVC 2. TypeScript – No static type checking, No Refactoring tools – Variable scopes are not clear – Software fails at runtime Build and deploy – Minification and obfuscation should be done explicitly – Hard to create builds based on configurations 3. AMD
  • 5. Client-side MVC in JavaScript View (HTML Template) Loads into DOM Controller Sends user actions Updates the DOM Creates the Binder Updates the Model (triggered by the user or the system) Binder (observer) Sends Updates Data Model Client (observable) Server Routes Rest of the Software
  • 7. Backbone.js http://backbonejs.org/ Used in Groupon Now!, Hulu, Delicious, Khan Academy, Foursquare,… Main concepts – – – – Model Collection View Router
  • 8. Backbone Model* * Available at http://backbonetutorials.com/
  • 10. Observing the changes in the Model Observable
  • 11. Binding the Model to the REST API POST /user : Server returns the ‘id’
  • 12. Retrieving Model’s data from the Server GET /user/1
  • 13. Update/Delete from the Server PUT /user/1 DELETE /user/1
  • 16. Connecting the View to the Model* * http://stackoverflow.com/questions/5651629/backbone-js-collections-and-views/5656433#5656433
  • 18. Backbone Pros and Cons Pros – – – – Tied to Underscore.js Lightweight (6K V1.1.0) Very flexible Works offline • Using LocalStorage • Optimistic since V0.9 Cons – Verbose (e.g., GPL vs DSL) – REST-oriented
  • 19. Asynchronous Module Definition AMD – – – – http://requirejs.org/ Allows creating packages, modules, and dependencies Automatically backed by a minifier (Closure compiler, Uglify) Cons: Does not allow circular dependencies has.js – https://github.com/phiggins42/has.js/ – Feature detection – build configuration • Dead code removal by Closure Compiler
  • 20. TypeScript Superset of JavaScript – Compiler (.ts => .js) – Open-source Language features: – – – – Static Type Checking Interfaces Classical Inheritance Generics http://www.typescriptlang.org Microsoft Visual Studio Plugin – Intellisense – Refactoring (e.g., variable renaming)
  • 21. Other MV* solutions Angular: MVW – Complete development framework – Two-way binding of View and Model – Increases development speed • 5K lines backbone app reported to become 750 lines – Opinionated Knockout – KO.Observable() Explore www.todomvc.com
  • 22. Other goodies Git, Github, Bitbucket Responsive Design – Bootstrap Glyph Icons, FontAwesome NoSQL Databases – MongoDB Server-side JS – Node.js CSS frameworks – LESS, Blueprint,… Real-time apps – Meteor, Derby, Firebase, Pusher Continuous Integration, Test-driven design – Buster, Jasmine, TestSwarm
  • 23. Conclusions Build large-scale Web applications with – MVC (Code Organization, Separation of Concerns) – AMD (Code Organization, Easy Deployment) – TypeScript (Static Type Checking) JS dev has been revolutionized in the last 5 years – Stay updated with the newest technologies – Consider integrating new tools into your projects – Consider migrating your existing projects!
  • 24. About Me http://www.linkedin.com/in/nahmadi navid.ai@gmail.com ASP.NET developer in 2002-2005 When C# was still in beta! Got into JavaScript development in 2006 2007-08: Created a Game Engine and Compiler – JS + Canvas Agent – 4K LOC Gallery Agent Gallery Depiction Editor 2009-11: Created an Online Game Design Environment Depiction – Front-end: JS + Dojo; Backend: Drupal + Nginx Editor – 15+K LOC UX design for novice users – Game level editor – Visual Programming Language Conditions Programming Environment Actions

Editor's Notes

  1. Left is older and has been around for a long timeRight is newer approach and more interesting as the Web is not about the page anymore but about the applications
  2. 1- They help organize the application 2- Convention over Configuration (of Rails)