SlideShare a Scribd company logo
Gil Fink

Building Scalable JavaScript Apps
Agenda
• The challenge we face
• Suggested solution
• The patterns
The Challenge
How would you define a scalable JavaScript app
architecture?
Non-trivial apps require significant developer
effort to maintain, where a browser plays a big
role in data manipulation and display
Scalable JavaScript App Examples
Gmail
Twitter
Facebook
Yahoo! Homepage
and more
Current Architecture
Might contain a mixture of the following:
Custom Widgets

Modules

Application Core

MV* Framework

JavaScript Libraries and Toolkits
Current Architecture – Cont.
Possible Problems
How much of the app is reusable?
Can single modules exist on their own
independently?
Can a single module be tested independently?
How much modules depend on other modules
in the system?
Is the application parts tightly coupled?
If a specific part fails, can the application still
work?
Suggested Solution: Mixing JS Patterns
Module Pattern

Façade Pattern

Mediator/Event
Aggregator
Suggested Solution
Module

Module

Module

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

…

Facade

Pub / Sub

Core
Libraries

jQuery

Application Core

Backbone
.js

postal.js

…
Modular JavaScript Review
Proven JavaScript patterns for creating modular
JavaScript
Leverage JavaScript’s built-in features
“Modularize” code into reusable objects
Prototype Pattern
Module Pattern
Revealing Module Pattern
Revealing Prototype Pattern
Or use libraries like RequireJS or Almond
Module Patterns
// Module pattern
var Car = function () {
// private variables
// private functions
return {
// public members
};
};

//Revealing prototype pattern
var Car = function (elm) {
// variables defined here
}
Car.prototype = function () {
// functions defined here
return {
// public members defined
// here as with revealing
// module pattern
};
}();
Module Patterns

Demo
Modules
Module

Module

Module

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

…

Facade

Pub / Sub

Core
Libraries

jQuery

Application Core

Backbone
.js

postal.js

…
Modules
Informs the application when something
interesting happens
Correctly publish events of interest
Shouldn’t concern about:
What objects or modules are being notified
Where these objects are based
How many objects subscribe to notifications
Application Core
Module

Module

Module

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

…

Facade

Pub / Sub

Core
Libraries

jQuery

Application Core

Backbone
.js

postal.js

…
The Application Core
Manages the module lifecycle
When is it safe for a module to start?
When should it stop?
Modules should execute automatically when started

Enables adding and removing modules without
breaking the app
Should handle detecting and managing of
errors
Uses the mediator pattern
The Façade
Module

Module

Module

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

…

Facade

Pub / Sub

Core
Libraries

jQuery

Application Core

Backbone
.js

postal.js

…
The Façade
• Convenient, high-level interfaces to larger code
that hide underlying complexity
• Limited public API of functionality

• Differs greatly from the reality of the
implementation
• Example:
var module = (function () {
…
return {
façade: function (args) {
// do something
}
};
}());
The Façade – Cont.
The Façade

Demo
The Façade
Will play a role of:
Abstraction to the application core
The façade sits in the middle between the core and
the modules
Ensure a consistent interface to the modules which is
available at all times
Should be the only thing that modules are aware of
If modules have API, they expose it using a façade
Mediator/Event Aggregator
Module

Module

Module

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

HTML / CSS /
JavaScript

…

Facade

Pub / Sub

Core
Libraries

jQuery

Application Core

Backbone
.js

postal.js

…
Mediator/Event Aggregator
Promotes loose coupling of components
Helps solve module coupling issues
Allow modules to broadcast or listen to
notifications from other modules
Notifications can be handled by any number of
modules at once
Mediator/Event Aggregator – Cont.
Mediator Implementation Example
var mediator = (function () {
var subscribe = function (channel, fn) {
…
},
publish = function (channel) {
…
},
return {
publish: publish,
subscribe: subscribe
};
}());
Mediator

Demo
Frameworks
Framework that leverages the proposed solution:
Most of the MV* frameworks include ways to apply the
architecture (AngularJS, Ember and Backbone for
example)
Aura: http://aurajs.com/
The Scalable Application Framework:
https://github.com/legalbox/lb_js_scalableApp
And many more

Can be a good start point to impose the patterns
Questions
Summary
•
•

Building big and scalable JavaScript app is very
challenging
Combining proven patterns can help to create
better software
Resources
Slide Deck and Demos - http://sdrv.ms/17riPkB
Nicholas Zakas: Scalable JavaScript Application
Architecture http://www.youtube.com/watch?v=vXjVFPosQHw
Addy Osmani: Scaling Your JavaScript Applications http://addyosmani.com/scalable-javascript-videos/
My Blog – http://www.gilfink.net
Follow me on Twitter – @gilfink
Thank You

More Related Content

What's hot (20)

PPTX
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
PDF
Creating MVC Application with backbone js
Mindfire Solutions
 
PDF
Model View Presenter
rendra toro
 
PDF
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Ivano Malavolta
 
PDF
Industry-Standard Web Development Techniques for Angular
Jai Prakash Mishra
 
PDF
What is front-end development ?
Mahmoud Shaker
 
PPTX
Angular Introduction
Anoop Kumar Sharma
 
PPTX
Writing HTML5 Web Apps using Backbone.js and GAE
Ron Reiter
 
PDF
Micro frontend: The microservices puzzle extended to frontend
Audrey Neveu
 
DOCX
Top 10 Javascript Frameworks For Easy Web Development
Technostacks Infotech Pvt. Ltd.
 
PPTX
JavaScript for ASP.NET programmers (webcast) upload
Russ Fustino
 
PPTX
10 top web development frameworks (new version 21 11)
Mandar Majmudar
 
PPTX
UI5con 2017 - UI5 Components - More Performance...
Peter Muessig
 
PDF
JavaCro'15 - Web UI best practice integration with Java EE 7 - Peter Lehto
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PDF
Developing WordPress Plugins : For Begineers
M A Hossain Tonu
 
PPTX
Chatbot development with Microsoft Bot Framework and LUIS
Md. Mahedee Hasan
 
PPT
Search Engine Optimization
Mindfire Solutions
 
PPTX
Ecommerce Mini Project / Group Project Coding
Hemant Sarthak
 
PPTX
Md M. Khan Professional Experience
Md Khan
 
PPTX
Aeternity Blockchain - Ecosystem & Devtools [2019]
Przemysław Thomann
 
Learning AngularJS - Complete coverage of AngularJS features and concepts
Suresh Patidar
 
Creating MVC Application with backbone js
Mindfire Solutions
 
Model View Presenter
rendra toro
 
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Ivano Malavolta
 
Industry-Standard Web Development Techniques for Angular
Jai Prakash Mishra
 
What is front-end development ?
Mahmoud Shaker
 
Angular Introduction
Anoop Kumar Sharma
 
Writing HTML5 Web Apps using Backbone.js and GAE
Ron Reiter
 
Micro frontend: The microservices puzzle extended to frontend
Audrey Neveu
 
Top 10 Javascript Frameworks For Easy Web Development
Technostacks Infotech Pvt. Ltd.
 
JavaScript for ASP.NET programmers (webcast) upload
Russ Fustino
 
10 top web development frameworks (new version 21 11)
Mandar Majmudar
 
UI5con 2017 - UI5 Components - More Performance...
Peter Muessig
 
JavaCro'15 - Web UI best practice integration with Java EE 7 - Peter Lehto
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Developing WordPress Plugins : For Begineers
M A Hossain Tonu
 
Chatbot development with Microsoft Bot Framework and LUIS
Md. Mahedee Hasan
 
Search Engine Optimization
Mindfire Solutions
 
Ecommerce Mini Project / Group Project Coding
Hemant Sarthak
 
Md M. Khan Professional Experience
Md Khan
 
Aeternity Blockchain - Ecosystem & Devtools [2019]
Przemysław Thomann
 

Viewers also liked (20)

PPT
#COP20Avanza
COP20 Lima
 
PDF
Dianproyectoestatutoaduanero6 dediciembrede2011
Rafael Maya Sanabria
 
PDF
Lodz Design Festival 2010
Michał Piernikowski
 
PDF
Pedrezuela, Bolsa de empleo 30 de enero de 2012
Pedrezuela Activa
 
PDF
New Drug Review Orbactiv Internal Medicine II FINAL
Amy Yeh
 
PDF
Analisis y diagnostico de la eficiencia energetica
Farid Mokhtar Noriega
 
PDF
EDICIÓN 209 El Comercio del Ecuador
El Comercio del Ecuador
 
PPTX
Abecedario
AndreaValladareso
 
PDF
Instruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics Trade
Optics-Trade
 
PDF
Spatial Earth Profile2
Vishwas Nirgude
 
PDF
Plan de “Gestión Integral de Residuos” en las Escuelas - Guía parael alumno
Daniel Delgado
 
PDF
Accuracy Post M&A disputes research
Heiko Ziehms
 
PDF
Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie
Ministère du Tourisme - Maroc
 
PPT
Specijalni rezervat prirode Zasavica
Dragica Novakovic
 
PDF
Regimenes autocratas tradicionalistas y sistemas mixtos
Carlos Lopez Mendizabal
 
PPT
Red Hot Chilli Peppers
Checomtze
 
PPTX
Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...
melidevelopers
 
PDF
Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...
Stanford School of Engineering
 
PDF
Enterprise Content Management am SharePoint mit ecspand
Christian Kiesewetter
 
PDF
PinkSlipParty Elevator Pitch Feb.2012
Jane Rodríguez del Tronco
 
#COP20Avanza
COP20 Lima
 
Dianproyectoestatutoaduanero6 dediciembrede2011
Rafael Maya Sanabria
 
Lodz Design Festival 2010
Michał Piernikowski
 
Pedrezuela, Bolsa de empleo 30 de enero de 2012
Pedrezuela Activa
 
New Drug Review Orbactiv Internal Medicine II FINAL
Amy Yeh
 
Analisis y diagnostico de la eficiencia energetica
Farid Mokhtar Noriega
 
EDICIÓN 209 El Comercio del Ecuador
El Comercio del Ecuador
 
Abecedario
AndreaValladareso
 
Instruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics Trade
Optics-Trade
 
Spatial Earth Profile2
Vishwas Nirgude
 
Plan de “Gestión Integral de Residuos” en las Escuelas - Guía parael alumno
Daniel Delgado
 
Accuracy Post M&A disputes research
Heiko Ziehms
 
Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie
Ministère du Tourisme - Maroc
 
Specijalni rezervat prirode Zasavica
Dragica Novakovic
 
Regimenes autocratas tradicionalistas y sistemas mixtos
Carlos Lopez Mendizabal
 
Red Hot Chilli Peppers
Checomtze
 
Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...
melidevelopers
 
Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...
Stanford School of Engineering
 
Enterprise Content Management am SharePoint mit ecspand
Christian Kiesewetter
 
PinkSlipParty Elevator Pitch Feb.2012
Jane Rodríguez del Tronco
 
Ad

Similar to Building Scalable JavaScript Apps (20)

PDF
Modern JavaScript Applications: Design Patterns
Volodymyr Voytyshyn
 
PDF
An overview of Scalable Web Application Front-end
Saeid Zebardast
 
PDF
JS Based Applications
Marcelo Henrique
 
PDF
Large-Scale JavaScript Development
Addy Osmani
 
PDF
Modern UI Architecture_ Trends and Technologies in Web Development
Suresh Patidar
 
PDF
Best practices for creating modular Web applications
peychevi
 
PPTX
jquery summit presentation for large scale javascript applications
DivyanshGupta922023
 
PDF
Building Large Scale Javascript Application
Anis Ahmad
 
PDF
Introduction to JavaScript design patterns
Jeremy Duvall
 
PDF
Built to Last
Dan Lynch
 
PDF
Building Large Scale Web Apps And Platforms
Anurag Sinha
 
PDF
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
PDF
Instant Download Node js Design Patterns Master best practices to build modul...
nobazaasiv
 
PDF
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
Leapfrog Technology Inc.
 
PDF
Node frameworks talk_hackerdojo
Shubhra Kar
 
PPTX
Built to last javascript for enterprise
Marjan Nikolovski
 
PDF
Best practices for JavaScript RIAs
Carlos Ble
 
PDF
Node js Design Patterns Master best practices to build modular and scalable s...
bowenshabagg
 
PDF
Александр Белецкий "Архитектура Javascript приложений"
Agile Base Camp
 
PDF
Node.JS
Kristaps Kūlis
 
Modern JavaScript Applications: Design Patterns
Volodymyr Voytyshyn
 
An overview of Scalable Web Application Front-end
Saeid Zebardast
 
JS Based Applications
Marcelo Henrique
 
Large-Scale JavaScript Development
Addy Osmani
 
Modern UI Architecture_ Trends and Technologies in Web Development
Suresh Patidar
 
Best practices for creating modular Web applications
peychevi
 
jquery summit presentation for large scale javascript applications
DivyanshGupta922023
 
Building Large Scale Javascript Application
Anis Ahmad
 
Introduction to JavaScript design patterns
Jeremy Duvall
 
Built to Last
Dan Lynch
 
Building Large Scale Web Apps And Platforms
Anurag Sinha
 
jQquerysummit - Large-scale JavaScript Application Architecture
Jiby John
 
Instant Download Node js Design Patterns Master best practices to build modul...
nobazaasiv
 
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
Leapfrog Technology Inc.
 
Node frameworks talk_hackerdojo
Shubhra Kar
 
Built to last javascript for enterprise
Marjan Nikolovski
 
Best practices for JavaScript RIAs
Carlos Ble
 
Node js Design Patterns Master best practices to build modular and scalable s...
bowenshabagg
 
Александр Белецкий "Архитектура Javascript приложений"
Agile Base Camp
 
Ad

More from Gil Fink (20)

PDF
Becoming a Tech Speaker
Gil Fink
 
PPTX
Web animation on steroids web animation api
Gil Fink
 
PDF
The Time for Vanilla Web Components has Arrived
Gil Fink
 
PDF
Stencil the time for vanilla web components has arrived
Gil Fink
 
PDF
Stencil the time for vanilla web components has arrived
Gil Fink
 
PDF
Stencil: The Time for Vanilla Web Components has Arrived
Gil Fink
 
PDF
Stencil the time for vanilla web components has arrived
Gil Fink
 
PDF
Being a tech speaker
Gil Fink
 
PDF
Working with Data in Service Workers
Gil Fink
 
PDF
Demystifying Angular Animations
Gil Fink
 
PDF
Redux data flow with angular
Gil Fink
 
PDF
Redux data flow with angular
Gil Fink
 
PDF
Who's afraid of front end databases?
Gil Fink
 
PDF
One language to rule them all type script
Gil Fink
 
PDF
End to-end apps with type script
Gil Fink
 
PDF
Web component driven development
Gil Fink
 
PDF
Web components
Gil Fink
 
PDF
Redux data flow with angular 2
Gil Fink
 
PDF
Biological Modeling, Powered by AngularJS
Gil Fink
 
PDF
Who's afraid of front end databases
Gil Fink
 
Becoming a Tech Speaker
Gil Fink
 
Web animation on steroids web animation api
Gil Fink
 
The Time for Vanilla Web Components has Arrived
Gil Fink
 
Stencil the time for vanilla web components has arrived
Gil Fink
 
Stencil the time for vanilla web components has arrived
Gil Fink
 
Stencil: The Time for Vanilla Web Components has Arrived
Gil Fink
 
Stencil the time for vanilla web components has arrived
Gil Fink
 
Being a tech speaker
Gil Fink
 
Working with Data in Service Workers
Gil Fink
 
Demystifying Angular Animations
Gil Fink
 
Redux data flow with angular
Gil Fink
 
Redux data flow with angular
Gil Fink
 
Who's afraid of front end databases?
Gil Fink
 
One language to rule them all type script
Gil Fink
 
End to-end apps with type script
Gil Fink
 
Web component driven development
Gil Fink
 
Web components
Gil Fink
 
Redux data flow with angular 2
Gil Fink
 
Biological Modeling, Powered by AngularJS
Gil Fink
 
Who's afraid of front end databases
Gil Fink
 

Recently uploaded (20)

PPTX
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PDF
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
PPTX
Simplifica la seguridad en la nube y la detección de amenazas con FortiCNAPP
Cristian Garcia G.
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PPTX
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
PDF
The Growing Value and Application of FME & GenAI
Safe Software
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
Open Source Milvus Vector Database v 2.6
Zilliz
 
PPTX
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
“Scaling i.MX Applications Processors’ Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
 
Simplifica la seguridad en la nube y la detección de amenazas con FortiCNAPP
Cristian Garcia G.
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
The Growing Value and Application of FME & GenAI
Safe Software
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Open Source Milvus Vector Database v 2.6
Zilliz
 
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 

Building Scalable JavaScript Apps

  • 1. Gil Fink Building Scalable JavaScript Apps
  • 2. Agenda • The challenge we face • Suggested solution • The patterns
  • 3. The Challenge How would you define a scalable JavaScript app architecture? Non-trivial apps require significant developer effort to maintain, where a browser plays a big role in data manipulation and display
  • 4. Scalable JavaScript App Examples Gmail Twitter Facebook Yahoo! Homepage and more
  • 5. Current Architecture Might contain a mixture of the following: Custom Widgets Modules Application Core MV* Framework JavaScript Libraries and Toolkits
  • 7. Possible Problems How much of the app is reusable? Can single modules exist on their own independently? Can a single module be tested independently? How much modules depend on other modules in the system? Is the application parts tightly coupled? If a specific part fails, can the application still work?
  • 8. Suggested Solution: Mixing JS Patterns Module Pattern Façade Pattern Mediator/Event Aggregator
  • 9. Suggested Solution Module Module Module HTML / CSS / JavaScript HTML / CSS / JavaScript HTML / CSS / JavaScript … Facade Pub / Sub Core Libraries jQuery Application Core Backbone .js postal.js …
  • 10. Modular JavaScript Review Proven JavaScript patterns for creating modular JavaScript Leverage JavaScript’s built-in features “Modularize” code into reusable objects Prototype Pattern Module Pattern Revealing Module Pattern Revealing Prototype Pattern Or use libraries like RequireJS or Almond
  • 11. Module Patterns // Module pattern var Car = function () { // private variables // private functions return { // public members }; }; //Revealing prototype pattern var Car = function (elm) { // variables defined here } Car.prototype = function () { // functions defined here return { // public members defined // here as with revealing // module pattern }; }();
  • 13. Modules Module Module Module HTML / CSS / JavaScript HTML / CSS / JavaScript HTML / CSS / JavaScript … Facade Pub / Sub Core Libraries jQuery Application Core Backbone .js postal.js …
  • 14. Modules Informs the application when something interesting happens Correctly publish events of interest Shouldn’t concern about: What objects or modules are being notified Where these objects are based How many objects subscribe to notifications
  • 15. Application Core Module Module Module HTML / CSS / JavaScript HTML / CSS / JavaScript HTML / CSS / JavaScript … Facade Pub / Sub Core Libraries jQuery Application Core Backbone .js postal.js …
  • 16. The Application Core Manages the module lifecycle When is it safe for a module to start? When should it stop? Modules should execute automatically when started Enables adding and removing modules without breaking the app Should handle detecting and managing of errors Uses the mediator pattern
  • 17. The Façade Module Module Module HTML / CSS / JavaScript HTML / CSS / JavaScript HTML / CSS / JavaScript … Facade Pub / Sub Core Libraries jQuery Application Core Backbone .js postal.js …
  • 18. The Façade • Convenient, high-level interfaces to larger code that hide underlying complexity • Limited public API of functionality • Differs greatly from the reality of the implementation • Example: var module = (function () { … return { façade: function (args) { // do something } }; }());
  • 21. The Façade Will play a role of: Abstraction to the application core The façade sits in the middle between the core and the modules Ensure a consistent interface to the modules which is available at all times Should be the only thing that modules are aware of If modules have API, they expose it using a façade
  • 22. Mediator/Event Aggregator Module Module Module HTML / CSS / JavaScript HTML / CSS / JavaScript HTML / CSS / JavaScript … Facade Pub / Sub Core Libraries jQuery Application Core Backbone .js postal.js …
  • 23. Mediator/Event Aggregator Promotes loose coupling of components Helps solve module coupling issues Allow modules to broadcast or listen to notifications from other modules Notifications can be handled by any number of modules at once
  • 25. Mediator Implementation Example var mediator = (function () { var subscribe = function (channel, fn) { … }, publish = function (channel) { … }, return { publish: publish, subscribe: subscribe }; }());
  • 27. Frameworks Framework that leverages the proposed solution: Most of the MV* frameworks include ways to apply the architecture (AngularJS, Ember and Backbone for example) Aura: http://aurajs.com/ The Scalable Application Framework: https://github.com/legalbox/lb_js_scalableApp And many more Can be a good start point to impose the patterns
  • 29. Summary • • Building big and scalable JavaScript app is very challenging Combining proven patterns can help to create better software
  • 30. Resources Slide Deck and Demos - http://sdrv.ms/17riPkB Nicholas Zakas: Scalable JavaScript Application Architecture http://www.youtube.com/watch?v=vXjVFPosQHw Addy Osmani: Scaling Your JavaScript Applications http://addyosmani.com/scalable-javascript-videos/ My Blog – http://www.gilfink.net Follow me on Twitter – @gilfink