SlideShare a Scribd company logo
1 of 31
Download to read offline
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

Learning AngularJS - Complete coverage of AngularJS features and concepts
Learning AngularJS  - Complete coverage of AngularJS features and conceptsLearning AngularJS  - Complete coverage of AngularJS features and concepts
Learning AngularJS - Complete coverage of AngularJS features and conceptsSuresh Patidar
 
Creating MVC Application with backbone js
Creating MVC Application with backbone jsCreating MVC Application with backbone js
Creating MVC Application with backbone jsMindfire Solutions
 
Model View Presenter
Model View Presenter Model View Presenter
Model View Presenter rendra toro
 
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...Ivano Malavolta
 
Industry-Standard Web Development Techniques for Angular
Industry-Standard Web Development Techniques for AngularIndustry-Standard Web Development Techniques for Angular
Industry-Standard Web Development Techniques for AngularJai Prakash Mishra
 
What is front-end development ?
What is front-end development ?What is front-end development ?
What is front-end development ?Mahmoud Shaker
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAERon Reiter
 
Micro frontend: The microservices puzzle extended to frontend
Micro frontend: The microservices puzzle  extended to frontendMicro frontend: The microservices puzzle  extended to frontend
Micro frontend: The microservices puzzle extended to frontendAudrey Neveu
 
JavaScript for ASP.NET programmers (webcast) upload
JavaScript for ASP.NET programmers (webcast) uploadJavaScript for ASP.NET programmers (webcast) upload
JavaScript for ASP.NET programmers (webcast) uploadRuss Fustino
 
10 top web development frameworks (new version 21 11)
10 top web development frameworks (new version 21 11)10 top web development frameworks (new version 21 11)
10 top web development frameworks (new version 21 11)Mandar Majmudar
 
UI5con 2017 - UI5 Components - More Performance...
UI5con 2017 - UI5 Components - More Performance...UI5con 2017 - UI5 Components - More Performance...
UI5con 2017 - UI5 Components - More Performance...Peter Muessig
 
Developing WordPress Plugins : For Begineers
Developing WordPress Plugins :  For BegineersDeveloping WordPress Plugins :  For Begineers
Developing WordPress Plugins : For BegineersM A Hossain Tonu
 
Chatbot development with Microsoft Bot Framework and LUIS
Chatbot development with Microsoft Bot Framework and LUISChatbot development with Microsoft Bot Framework and LUIS
Chatbot development with Microsoft Bot Framework and LUISMd. Mahedee Hasan
 
Ecommerce Mini Project / Group Project Coding
Ecommerce Mini Project / Group Project CodingEcommerce Mini Project / Group Project Coding
Ecommerce Mini Project / Group Project CodingHemant Sarthak
 
Md M. Khan Professional Experience
Md M. Khan Professional ExperienceMd M. Khan Professional Experience
Md M. Khan Professional ExperienceMd Khan
 
Aeternity Blockchain - Ecosystem & Devtools [2019]
Aeternity Blockchain - Ecosystem & Devtools [2019]Aeternity Blockchain - Ecosystem & Devtools [2019]
Aeternity Blockchain - Ecosystem & Devtools [2019]Przemysław Thomann
 

What's hot (20)

Learning AngularJS - Complete coverage of AngularJS features and concepts
Learning AngularJS  - Complete coverage of AngularJS features and conceptsLearning AngularJS  - Complete coverage of AngularJS features and concepts
Learning AngularJS - Complete coverage of AngularJS features and concepts
 
Creating MVC Application with backbone js
Creating MVC Application with backbone jsCreating MVC Application with backbone js
Creating MVC Application with backbone js
 
Model View Presenter
Model View Presenter Model View Presenter
Model View Presenter
 
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
 
Industry-Standard Web Development Techniques for Angular
Industry-Standard Web Development Techniques for AngularIndustry-Standard Web Development Techniques for Angular
Industry-Standard Web Development Techniques for Angular
 
What is front-end development ?
What is front-end development ?What is front-end development ?
What is front-end development ?
 
Angular Introduction
Angular IntroductionAngular Introduction
Angular Introduction
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
 
Micro frontend: The microservices puzzle extended to frontend
Micro frontend: The microservices puzzle  extended to frontendMicro frontend: The microservices puzzle  extended to frontend
Micro frontend: The microservices puzzle extended to frontend
 
Top 10 Javascript Frameworks For Easy Web Development
Top 10 Javascript Frameworks For Easy Web DevelopmentTop 10 Javascript Frameworks For Easy Web Development
Top 10 Javascript Frameworks For Easy Web Development
 
JavaScript for ASP.NET programmers (webcast) upload
JavaScript for ASP.NET programmers (webcast) uploadJavaScript for ASP.NET programmers (webcast) upload
JavaScript for ASP.NET programmers (webcast) upload
 
10 top web development frameworks (new version 21 11)
10 top web development frameworks (new version 21 11)10 top web development frameworks (new version 21 11)
10 top web development frameworks (new version 21 11)
 
UI5con 2017 - UI5 Components - More Performance...
UI5con 2017 - UI5 Components - More Performance...UI5con 2017 - UI5 Components - More Performance...
UI5con 2017 - UI5 Components - More Performance...
 
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
 
Developing WordPress Plugins : For Begineers
Developing WordPress Plugins :  For BegineersDeveloping WordPress Plugins :  For Begineers
Developing WordPress Plugins : For Begineers
 
Chatbot development with Microsoft Bot Framework and LUIS
Chatbot development with Microsoft Bot Framework and LUISChatbot development with Microsoft Bot Framework and LUIS
Chatbot development with Microsoft Bot Framework and LUIS
 
Search Engine Optimization
Search Engine OptimizationSearch Engine Optimization
Search Engine Optimization
 
Ecommerce Mini Project / Group Project Coding
Ecommerce Mini Project / Group Project CodingEcommerce Mini Project / Group Project Coding
Ecommerce Mini Project / Group Project Coding
 
Md M. Khan Professional Experience
Md M. Khan Professional ExperienceMd M. Khan Professional Experience
Md M. Khan Professional Experience
 
Aeternity Blockchain - Ecosystem & Devtools [2019]
Aeternity Blockchain - Ecosystem & Devtools [2019]Aeternity Blockchain - Ecosystem & Devtools [2019]
Aeternity Blockchain - Ecosystem & Devtools [2019]
 

Viewers also liked

Dianproyectoestatutoaduanero6 dediciembrede2011
Dianproyectoestatutoaduanero6 dediciembrede2011Dianproyectoestatutoaduanero6 dediciembrede2011
Dianproyectoestatutoaduanero6 dediciembrede2011Rafael Maya Sanabria
 
Pedrezuela, Bolsa de empleo 30 de enero de 2012
Pedrezuela, Bolsa de empleo 30 de enero de 2012Pedrezuela, Bolsa de empleo 30 de enero de 2012
Pedrezuela, Bolsa de empleo 30 de enero de 2012Pedrezuela Activa
 
New Drug Review Orbactiv Internal Medicine II FINAL
New Drug Review Orbactiv Internal Medicine II FINALNew Drug Review Orbactiv Internal Medicine II FINAL
New Drug Review Orbactiv Internal Medicine II FINALAmy Yeh
 
Analisis y diagnostico de la eficiencia energetica
Analisis y diagnostico de la eficiencia energeticaAnalisis y diagnostico de la eficiencia energetica
Analisis y diagnostico de la eficiencia energeticaFarid Mokhtar Noriega
 
Instruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics Trade
Instruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics TradeInstruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics Trade
Instruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics TradeOptics-Trade
 
Plan de “Gestión Integral de Residuos” en las Escuelas - Guía parael alumno
Plan de “Gestión Integral  de Residuos” en las Escuelas - Guía parael alumnoPlan de “Gestión Integral  de Residuos” en las Escuelas - Guía parael alumno
Plan de “Gestión Integral de Residuos” en las Escuelas - Guía parael alumnoDaniel Delgado
 
Accuracy Post M&A disputes research
Accuracy Post M&A disputes researchAccuracy Post M&A disputes research
Accuracy Post M&A disputes researchHeiko Ziehms
 
Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie
Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie
Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie Ministère du Tourisme - Maroc
 
Specijalni rezervat prirode Zasavica
Specijalni rezervat prirode ZasavicaSpecijalni rezervat prirode Zasavica
Specijalni rezervat prirode ZasavicaDragica Novakovic
 
Regimenes autocratas tradicionalistas y sistemas mixtos
Regimenes autocratas tradicionalistas y sistemas mixtosRegimenes autocratas tradicionalistas y sistemas mixtos
Regimenes autocratas tradicionalistas y sistemas mixtosCarlos Lopez Mendizabal
 
Red Hot Chilli Peppers
Red Hot Chilli PeppersRed Hot Chilli Peppers
Red Hot Chilli PeppersChecomtze
 
Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...
Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...
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...
Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...
Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...Stanford School of Engineering
 
Enterprise Content Management am SharePoint mit ecspand
Enterprise Content Management am SharePoint mit ecspandEnterprise Content Management am SharePoint mit ecspand
Enterprise Content Management am SharePoint mit ecspandChristian Kiesewetter
 

Viewers also liked (20)

#COP20Avanza
#COP20Avanza #COP20Avanza
#COP20Avanza
 
Dianproyectoestatutoaduanero6 dediciembrede2011
Dianproyectoestatutoaduanero6 dediciembrede2011Dianproyectoestatutoaduanero6 dediciembrede2011
Dianproyectoestatutoaduanero6 dediciembrede2011
 
Lodz Design Festival 2010
Lodz Design Festival 2010Lodz Design Festival 2010
Lodz Design Festival 2010
 
Pedrezuela, Bolsa de empleo 30 de enero de 2012
Pedrezuela, Bolsa de empleo 30 de enero de 2012Pedrezuela, Bolsa de empleo 30 de enero de 2012
Pedrezuela, Bolsa de empleo 30 de enero de 2012
 
New Drug Review Orbactiv Internal Medicine II FINAL
New Drug Review Orbactiv Internal Medicine II FINALNew Drug Review Orbactiv Internal Medicine II FINAL
New Drug Review Orbactiv Internal Medicine II FINAL
 
Analisis y diagnostico de la eficiencia energetica
Analisis y diagnostico de la eficiencia energeticaAnalisis y diagnostico de la eficiencia energetica
Analisis y diagnostico de la eficiencia energetica
 
EDICIÓN 209 El Comercio del Ecuador
EDICIÓN 209 El Comercio del EcuadorEDICIÓN 209 El Comercio del Ecuador
EDICIÓN 209 El Comercio del Ecuador
 
Abecedario
AbecedarioAbecedario
Abecedario
 
Instruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics Trade
Instruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics TradeInstruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics Trade
Instruction Manual ARMASIGHT Mount AIM PRO, AIM PRO-L | Optics Trade
 
Spatial Earth Profile2
Spatial Earth Profile2Spatial Earth Profile2
Spatial Earth Profile2
 
Plan de “Gestión Integral de Residuos” en las Escuelas - Guía parael alumno
Plan de “Gestión Integral  de Residuos” en las Escuelas - Guía parael alumnoPlan de “Gestión Integral  de Residuos” en las Escuelas - Guía parael alumno
Plan de “Gestión Integral de Residuos” en las Escuelas - Guía parael alumno
 
Accuracy Post M&A disputes research
Accuracy Post M&A disputes researchAccuracy Post M&A disputes research
Accuracy Post M&A disputes research
 
Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie
Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie
Guide Métier de la Durabilité : Responsabilité sociétale dans l'hôtellerie
 
Specijalni rezervat prirode Zasavica
Specijalni rezervat prirode ZasavicaSpecijalni rezervat prirode Zasavica
Specijalni rezervat prirode Zasavica
 
Regimenes autocratas tradicionalistas y sistemas mixtos
Regimenes autocratas tradicionalistas y sistemas mixtosRegimenes autocratas tradicionalistas y sistemas mixtos
Regimenes autocratas tradicionalistas y sistemas mixtos
 
Red Hot Chilli Peppers
Red Hot Chilli PeppersRed Hot Chilli Peppers
Red Hot Chilli Peppers
 
Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...
Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...
Mercado Pago Open Platform - Construí la solución de pagos que tu negocio nec...
 
Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...
Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...
Turbulence and Computing: Beauty and the Beast - Assistant Professor Gianluca...
 
Enterprise Content Management am SharePoint mit ecspand
Enterprise Content Management am SharePoint mit ecspandEnterprise Content Management am SharePoint mit ecspand
Enterprise Content Management am SharePoint mit ecspand
 
PinkSlipParty Elevator Pitch Feb.2012
PinkSlipParty Elevator Pitch Feb.2012PinkSlipParty Elevator Pitch Feb.2012
PinkSlipParty Elevator Pitch Feb.2012
 

Similar to Building Scalable JavaScript Apps

Александр Белецкий "Архитектура Javascript приложений"
 Александр Белецкий "Архитектура Javascript приложений" Александр Белецкий "Архитектура Javascript приложений"
Александр Белецкий "Архитектура Javascript приложений"Agile Base Camp
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsVolodymyr Voytyshyn
 
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai..."Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...Fwdays
 
An overview of Scalable Web Application Front-end
An overview of Scalable Web Application Front-endAn overview of Scalable Web Application Front-end
An overview of Scalable Web Application Front-endSaeid Zebardast
 
Design pattern in an expressive language java script
Design pattern in an expressive language java scriptDesign pattern in an expressive language java script
Design pattern in an expressive language java scriptAmit Thakkar
 
Developing large scale JavaScript applications
Developing large scale JavaScript applicationsDeveloping large scale JavaScript applications
Developing large scale JavaScript applicationsMilan Korsos
 
Marionette - TorontoJS
Marionette - TorontoJSMarionette - TorontoJS
Marionette - TorontoJSmatt-briggs
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design PatternsLilia Sfaxi
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatiasapientindia
 
From Containerization to Modularity
From Containerization to ModularityFrom Containerization to Modularity
From Containerization to Modularityoasisfeng
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring FrameworkEdureka!
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | IntroductionJohnTaieb
 
5 Front End Frameworks to Master in Web Development.pdf
5 Front End Frameworks to Master in Web Development.pdf5 Front End Frameworks to Master in Web Development.pdf
5 Front End Frameworks to Master in Web Development.pdfMverve1
 
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...Katy Slemon
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net coreSam Nasr, MCSA, MVP
 
A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the informationToushik Paul
 

Similar to Building Scalable JavaScript Apps (20)

Александр Белецкий "Архитектура Javascript приложений"
 Александр Белецкий "Архитектура Javascript приложений" Александр Белецкий "Архитектура Javascript приложений"
Александр Белецкий "Архитектура Javascript приложений"
 
Design pattern
Design patternDesign pattern
Design pattern
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design Patterns
 
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai..."Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Ai...
 
An overview of Scalable Web Application Front-end
An overview of Scalable Web Application Front-endAn overview of Scalable Web Application Front-end
An overview of Scalable Web Application Front-end
 
Design pattern in an expressive language java script
Design pattern in an expressive language java scriptDesign pattern in an expressive language java script
Design pattern in an expressive language java script
 
Developing large scale JavaScript applications
Developing large scale JavaScript applicationsDeveloping large scale JavaScript applications
Developing large scale JavaScript applications
 
Marionette - TorontoJS
Marionette - TorontoJSMarionette - TorontoJS
Marionette - TorontoJS
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 
From Containerization to Modularity
From Containerization to ModularityFrom Containerization to Modularity
From Containerization to Modularity
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Getting Started with Spring Framework
Getting Started with Spring FrameworkGetting Started with Spring Framework
Getting Started with Spring Framework
 
Front End Development | Introduction
Front End Development | IntroductionFront End Development | Introduction
Front End Development | Introduction
 
5 Front End Frameworks to Master in Web Development.pdf
5 Front End Frameworks to Master in Web Development.pdf5 Front End Frameworks to Master in Web Development.pdf
5 Front End Frameworks to Master in Web Development.pdf
 
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
 
Micro Front Ends : Divided We Rule by Parth Ghiya - AhmedabadJS
Micro Front Ends : Divided We Rule by Parth Ghiya - AhmedabadJSMicro Front Ends : Divided We Rule by Parth Ghiya - AhmedabadJS
Micro Front Ends : Divided We Rule by Parth Ghiya - AhmedabadJS
 
Clean architecture with asp.net core
Clean architecture with asp.net coreClean architecture with asp.net core
Clean architecture with asp.net core
 
A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the information
 
Javascript frameworks
Javascript frameworksJavascript frameworks
Javascript frameworks
 

More from Gil Fink

Becoming a Tech Speaker
Becoming a Tech SpeakerBecoming a Tech Speaker
Becoming a Tech SpeakerGil Fink
 
Web animation on steroids web animation api
Web animation on steroids web animation api Web animation on steroids web animation api
Web animation on steroids web animation api Gil Fink
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedGil Fink
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
Stencil: The Time for Vanilla Web Components has Arrived
Stencil: The Time for Vanilla Web Components has ArrivedStencil: The Time for Vanilla Web Components has Arrived
Stencil: The Time for Vanilla Web Components has ArrivedGil Fink
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
Being a tech speaker
Being a tech speakerBeing a tech speaker
Being a tech speakerGil Fink
 
Working with Data in Service Workers
Working with Data in Service WorkersWorking with Data in Service Workers
Working with Data in Service WorkersGil Fink
 
Demystifying Angular Animations
Demystifying Angular AnimationsDemystifying Angular Animations
Demystifying Angular AnimationsGil Fink
 
Redux data flow with angular
Redux data flow with angularRedux data flow with angular
Redux data flow with angularGil Fink
 
Redux data flow with angular
Redux data flow with angularRedux data flow with angular
Redux data flow with angularGil Fink
 
Who's afraid of front end databases?
Who's afraid of front end databases?Who's afraid of front end databases?
Who's afraid of front end databases?Gil Fink
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type scriptGil Fink
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type scriptGil Fink
 
Web component driven development
Web component driven developmentWeb component driven development
Web component driven developmentGil Fink
 
Web components
Web componentsWeb components
Web componentsGil Fink
 
Redux data flow with angular 2
Redux data flow with angular 2Redux data flow with angular 2
Redux data flow with angular 2Gil Fink
 
Biological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSBiological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSGil Fink
 
Who's afraid of front end databases
Who's afraid of front end databasesWho's afraid of front end databases
Who's afraid of front end databasesGil Fink
 

More from Gil Fink (20)

Becoming a Tech Speaker
Becoming a Tech SpeakerBecoming a Tech Speaker
Becoming a Tech Speaker
 
Web animation on steroids web animation api
Web animation on steroids web animation api Web animation on steroids web animation api
Web animation on steroids web animation api
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has Arrived
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Stencil: The Time for Vanilla Web Components has Arrived
Stencil: The Time for Vanilla Web Components has ArrivedStencil: The Time for Vanilla Web Components has Arrived
Stencil: The Time for Vanilla Web Components has Arrived
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Being a tech speaker
Being a tech speakerBeing a tech speaker
Being a tech speaker
 
Working with Data in Service Workers
Working with Data in Service WorkersWorking with Data in Service Workers
Working with Data in Service Workers
 
Demystifying Angular Animations
Demystifying Angular AnimationsDemystifying Angular Animations
Demystifying Angular Animations
 
Redux data flow with angular
Redux data flow with angularRedux data flow with angular
Redux data flow with angular
 
Redux data flow with angular
Redux data flow with angularRedux data flow with angular
Redux data flow with angular
 
Who's afraid of front end databases?
Who's afraid of front end databases?Who's afraid of front end databases?
Who's afraid of front end databases?
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type script
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type script
 
Web component driven development
Web component driven developmentWeb component driven development
Web component driven development
 
Web components
Web componentsWeb components
Web components
 
Redux data flow with angular 2
Redux data flow with angular 2Redux data flow with angular 2
Redux data flow with angular 2
 
Biological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSBiological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJS
 
Who's afraid of front end databases
Who's afraid of front end databasesWho's afraid of front end databases
Who's afraid of front end databases
 

Recently uploaded

Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

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