SlideShare a Scribd company logo
MARIONETTE
SHALL WE DANCE?
KSENIA REDUNOVA
BACKBONE.JS
PROS & CONS
• Simple & flexible
• Event-driven architecture
• Model/Collection implementation for REST
• MVW
PROS
• Simple :)
• Too easy to go in wrong direction
• No main Application class
• No nesting of views
• No layouts (header/footer/sidebar/content etc)
• Method render does nothing by default
• Memory management
CONS
MARIONETTE
Complex lib intended for large-scale apps development
• Has a bunch of common design patterns
• Lowers amount of standard code because of view
types
• Has nested views
• Manages memory
• Combines event-driven architecture and event
aggregator
Marionette.Application
• App management - start, stop, and other
functionality
• Modularity
• “application” is just an object
MODULE
Is deprecated!
use AMD/CommonJS/ES6 modules
MARIONETTE VIEW MAGIC
MARIONETTE VIEW MAGIC
• Rendering connected to model changes
• Template management
• Has UI object
• Has .close() method
• Extensible
TEMPLATE HELPERS
TEMPLATE HELPERS
Marionette.ItemView
• View is rendered based on model data
• “model” attribute
• “template” attribute
• is rendered automatically
• modelEvents – view methods are called on model
events
UI OBJECT
UI hash in the view maps UI elements by their jQuery
selectors
Marionette.CollectionView
• View is rendered based on Collection data
• Automatic re-render on add/remove/reset/etc events
• childView attribute is automatically instantiated and
linked with model
COLLECTION VIEWS
Marionette.CompositeView
• CompositeView = CollectionView + template
• combination of ItemView and CollectionView
• renders elements of Backbone.Collection inside
wrapper
• inherits Marionette.CollectionView
MODEL EVENTS & COLLECTION EVENTS
ZOMBIE APOCALYPSE
REGION
• View intended to manage the lifecycle of other views
• Renders view instance and adds it to DOM
• It’s a bridge between DOM and backbone
• Nested regions - LayoutView class
DISPLAY A VIEW
IN A REGION
LAYOUT
• Unlike ItemView it contains regions
• Is good to be a widget with several views
LAYOUT
BACKBONE.WREQR
& BACKBONE.RADIO
MESSAGING BUS
• Event - app-level events
• Commands - run commands
• Request/Response - request of specific
values/states
EVENT AGGREGATOR
• pub/sub
• trigger/bind
• Notifies the app about events in different parts
(“user:logged-in”)
• App level events are like global function calls
• Different event types, namespaces define the
semantics
EVENT AGGREGATOR
COMMANDS
Commands are used to make any component
tell another component to perform an action
without a direct reference to it.
• Subscribe for a command - only once
• Example: Save command
• cmd-s
• Clicking a toolbar button
• Choosing File => Save from the menubar
COMMANDS
REQUEST / RESPONSE
• Request Response is a means for any component
to request information from another component
without being tightly coupled.
• For app level data (e. g. shopping cart status)
• Requests have intention
• The requests are 'one-to-one'
REQUEST / RESPONSE
Backbone.Radio.channel
// Get a reference to the channel named 'user'
var userChannel = Backbone.Radio.channel('user');
userChannel.on('some:event', function() {
console.log('An event has happened!');
});
userChannel.reply('some:request', 'food is good');
userChannel.trigger('some:event');
Combination of Backbone.Events and
Radio.Requests
SUMMARY
MESSAGING BUS
• Application.vent - instance of Backbone.Wreqr.EventAggregator.
pub/sub.
• Application.commands - instance of Backbone.Wreqr.Commands.
Subscribe to command execution - once
• Application.reqres - instance of
Backbone.Wreqr.RequestResponse. Only one subscriber
performs the request
• Backbone.Radio.channel
• Child views - Backbone.BabySitter
• Marionette.RegionManager
• Marionette.TemplateCache
OTHER COOL THINGS FOR
VIEWS MANAGEMENT
LINKS
MarionetteJS.com (Derick Bailey)
BackboneRails.com (Brian Mann)
“Marionette: gentle introduction” by David Sulc
http://benmccormick.org/2015/01/26/backbone-radio/
THANK YOU!

More Related Content

What's hot

AAI 2235-OpenJPA and EclipseLink Usage Scenarios Explained
AAI 2235-OpenJPA and EclipseLink Usage Scenarios ExplainedAAI 2235-OpenJPA and EclipseLink Usage Scenarios Explained
AAI 2235-OpenJPA and EclipseLink Usage Scenarios Explained
Kevin Sutter
 
OpenFaaS
OpenFaaSOpenFaaS
OpenFaaS
Jacopo Carlini
 
Intro to openfaas
Intro to openfaasIntro to openfaas
Intro to openfaas
Hong Zhan (Michael) Huang
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
Aidan Casey
 
Uniqueness of java
Uniqueness of javaUniqueness of java
Uniqueness of java
Sandeep Pandey
 
Kudu voodoo slideshare
Kudu voodoo   slideshareKudu voodoo   slideshare
Kudu voodoo slideshare
Aidan Casey
 
Optimizing Access with SQL Server
Optimizing Access with SQL ServerOptimizing Access with SQL Server
Optimizing Access with SQL Server
PRPASS Chapter
 
The 7 deadly sins of micro services
The 7 deadly sins of micro servicesThe 7 deadly sins of micro services
The 7 deadly sins of micro services
Aidan Casey
 
Flywaydb
FlywaydbFlywaydb
Laravel session 1
Laravel  session 1Laravel  session 1
Laravel session 1
Ashish Kumar
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive ui
Paul van Zyl
 
Indic threads pune12-typesafe stack software development on the jvm
Indic threads pune12-typesafe stack software development on the jvmIndic threads pune12-typesafe stack software development on the jvm
Indic threads pune12-typesafe stack software development on the jvm
IndicThreads
 
The 7 deadly sins of micro services
The 7 deadly sins of micro servicesThe 7 deadly sins of micro services
The 7 deadly sins of micro services
Aidan Casey
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETAlan Hecht
 
Sql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA'sSql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA's
Navneet Upneja
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprises
Mike Slinn
 
Flyway
FlywayFlyway
KnowItPresentation
KnowItPresentationKnowItPresentation
KnowItPresentation
Chuan Su
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and Symfony
MichalSchroeder
 
SenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
SenchaCon 2016: Oracle Forms Modernisation - Owen PaganSenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
SenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
Sencha
 

What's hot (20)

AAI 2235-OpenJPA and EclipseLink Usage Scenarios Explained
AAI 2235-OpenJPA and EclipseLink Usage Scenarios ExplainedAAI 2235-OpenJPA and EclipseLink Usage Scenarios Explained
AAI 2235-OpenJPA and EclipseLink Usage Scenarios Explained
 
OpenFaaS
OpenFaaSOpenFaaS
OpenFaaS
 
Intro to openfaas
Intro to openfaasIntro to openfaas
Intro to openfaas
 
Essential git for developers
Essential git for developersEssential git for developers
Essential git for developers
 
Uniqueness of java
Uniqueness of javaUniqueness of java
Uniqueness of java
 
Kudu voodoo slideshare
Kudu voodoo   slideshareKudu voodoo   slideshare
Kudu voodoo slideshare
 
Optimizing Access with SQL Server
Optimizing Access with SQL ServerOptimizing Access with SQL Server
Optimizing Access with SQL Server
 
The 7 deadly sins of micro services
The 7 deadly sins of micro servicesThe 7 deadly sins of micro services
The 7 deadly sins of micro services
 
Flywaydb
FlywaydbFlywaydb
Flywaydb
 
Laravel session 1
Laravel  session 1Laravel  session 1
Laravel session 1
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive ui
 
Indic threads pune12-typesafe stack software development on the jvm
Indic threads pune12-typesafe stack software development on the jvmIndic threads pune12-typesafe stack software development on the jvm
Indic threads pune12-typesafe stack software development on the jvm
 
The 7 deadly sins of micro services
The 7 deadly sins of micro servicesThe 7 deadly sins of micro services
The 7 deadly sins of micro services
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NET
 
Sql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA'sSql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA's
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprises
 
Flyway
FlywayFlyway
Flyway
 
KnowItPresentation
KnowItPresentationKnowItPresentation
KnowItPresentation
 
SOA with PHP and Symfony
SOA with PHP and SymfonySOA with PHP and Symfony
SOA with PHP and Symfony
 
SenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
SenchaCon 2016: Oracle Forms Modernisation - Owen PaganSenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
SenchaCon 2016: Oracle Forms Modernisation - Owen Pagan
 

Viewers also liked

Unidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftUnidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in Swift
Seyhun AKYUREK
 
JavaScript in Mobile Development
JavaScript in Mobile DevelopmentJavaScript in Mobile Development
JavaScript in Mobile Development
Dima Maleev
 
Creation of ideas
Creation of ideasCreation of ideas
Creation of ideas
Mykola Hlibovych
 
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
NoSQLmatters
 
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
AWS Simple Workflow: Distributed Out of the Box! - Morning@LohikaAWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
Serhiy Batyuk
 
Spark - Migration Story
Spark - Migration Story Spark - Migration Story
Spark - Migration Story
Roman Chukh
 
Backbone And Marionette : Take Over The World
Backbone And Marionette : Take Over The WorldBackbone And Marionette : Take Over The World
Backbone And Marionette : Take Over The World
harshit040591
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.js
Jonathan Weiss
 
Intro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General AssemblyIntro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General Assembly
Azat Mardanov
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.js
Roman Kalyakin
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
Knoldus Inc.
 
Introduction à Marionette
Introduction à MarionetteIntroduction à Marionette
Introduction à Marionette
Raphaël Lemaire
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
Mark
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ... Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Mikko Ohtamaa
 
Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]
Andrii Lundiak
 
Introduction to Marionette Collective
Introduction to Marionette CollectiveIntroduction to Marionette Collective
Introduction to Marionette Collective
Puppet
 
Big data analysis in java world
Big data analysis in java worldBig data analysis in java world
Big data analysis in java world
Serg Masyutin
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.js
Return on Intelligence
 
Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projects
Dmitriy Dumanskiy
 

Viewers also liked (20)

Unidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in SwiftUnidirectional Data Flow Architecture (Redux) in Swift
Unidirectional Data Flow Architecture (Redux) in Swift
 
JavaScript in Mobile Development
JavaScript in Mobile DevelopmentJavaScript in Mobile Development
JavaScript in Mobile Development
 
Creation of ideas
Creation of ideasCreation of ideas
Creation of ideas
 
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
DuyHai DOAN - Real time analytics with Cassandra and Spark - NoSQL matters Pa...
 
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
AWS Simple Workflow: Distributed Out of the Box! - Morning@LohikaAWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
AWS Simple Workflow: Distributed Out of the Box! - Morning@Lohika
 
Spark - Migration Story
Spark - Migration Story Spark - Migration Story
Spark - Migration Story
 
Backbone And Marionette : Take Over The World
Backbone And Marionette : Take Over The WorldBackbone And Marionette : Take Over The World
Backbone And Marionette : Take Over The World
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.js
 
Intro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General AssemblyIntro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General Assembly
 
Introduction to Backbone.js
Introduction to Backbone.jsIntroduction to Backbone.js
Introduction to Backbone.js
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Introduction à Marionette
Introduction à MarionetteIntroduction à Marionette
Introduction à Marionette
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
 
MVC & backbone.js
MVC & backbone.jsMVC & backbone.js
MVC & backbone.js
 
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ... Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
Beautiful Maintainable ModularJavascript Codebase with RequireJS - HelsinkiJ...
 
Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]Backbone/Marionette recap [2015]
Backbone/Marionette recap [2015]
 
Introduction to Marionette Collective
Introduction to Marionette CollectiveIntroduction to Marionette Collective
Introduction to Marionette Collective
 
Big data analysis in java world
Big data analysis in java worldBig data analysis in java world
Big data analysis in java world
 
Introduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.jsIntroduction to Backbone.js & Marionette.js
Introduction to Backbone.js & Marionette.js
 
Tweaking performance on high-load projects
Tweaking performance on high-load projectsTweaking performance on high-load projects
Tweaking performance on high-load projects
 

Similar to Marionette talk 2016

MVP Clean Architecture
MVP Clean  Architecture MVP Clean  Architecture
MVP Clean Architecture
Himanshu Dudhat
 
Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile apps
Ivano Malavolta
 
[2015/2016] Backbone JS
[2015/2016] Backbone JS[2015/2016] Backbone JS
[2015/2016] Backbone JS
Ivano Malavolta
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
Ivano Malavolta
 
Chapter 6 implementation support
Chapter 6 implementation supportChapter 6 implementation support
Chapter 6 implementation support
MLG College of Learning, Inc
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
Qamar Abbas
 
Siebel Open UI Presentation
Siebel Open UI PresentationSiebel Open UI Presentation
Siebel Open UI Presentation
Ajeeth Pingle
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
Ivano Malavolta
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
Ivano Malavolta
 
JAVA Programming : Topic JAVA Programming Swing
JAVA Programming : Topic JAVA Programming SwingJAVA Programming : Topic JAVA Programming Swing
JAVA Programming : Topic JAVA Programming Swing
Navya Francis
 
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
MVP Community Camp 2014 - How to useenhanced features of Windows 8.1 Store ...MVP Community Camp 2014 - How to useenhanced features of Windows 8.1 Store ...
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
Akira Hatsune
 
Highly Scalable User Experience Design: Vaadin and Magnolia
Highly Scalable User Experience Design: Vaadin and MagnoliaHighly Scalable User Experience Design: Vaadin and Magnolia
Highly Scalable User Experience Design: Vaadin and Magnolia
Magnolia
 
Client Side MVC with Backbone and Rails
Client Side MVC with Backbone and RailsClient Side MVC with Backbone and Rails
Client Side MVC with Backbone and Rails
Tom Z Zeng
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
Abhishek Sur
 
Prism Tech Ed India
Prism Tech Ed IndiaPrism Tech Ed India
Prism Tech Ed Indiarsnarayanan
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012
Adam Mokan
 
Dreamforce 2017 - Up close and personal with Lightning Experience as Platform
Dreamforce 2017 - Up close and personal with Lightning Experience as PlatformDreamforce 2017 - Up close and personal with Lightning Experience as Platform
Dreamforce 2017 - Up close and personal with Lightning Experience as Platform
andyinthecloud
 
Android architecture
Android architectureAndroid architecture
Android architecture
Deepa Rahul
 
Porting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application GuidancePorting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application Guidance
Our Community Exchange LLC
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
Betclic Everest Group Tech Team
 

Similar to Marionette talk 2016 (20)

MVP Clean Architecture
MVP Clean  Architecture MVP Clean  Architecture
MVP Clean Architecture
 
Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile apps
 
[2015/2016] Backbone JS
[2015/2016] Backbone JS[2015/2016] Backbone JS
[2015/2016] Backbone JS
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Chapter 6 implementation support
Chapter 6 implementation supportChapter 6 implementation support
Chapter 6 implementation support
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
 
Siebel Open UI Presentation
Siebel Open UI PresentationSiebel Open UI Presentation
Siebel Open UI Presentation
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
 
JAVA Programming : Topic JAVA Programming Swing
JAVA Programming : Topic JAVA Programming SwingJAVA Programming : Topic JAVA Programming Swing
JAVA Programming : Topic JAVA Programming Swing
 
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
MVP Community Camp 2014 - How to useenhanced features of Windows 8.1 Store ...MVP Community Camp 2014 - How to useenhanced features of Windows 8.1 Store ...
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
 
Highly Scalable User Experience Design: Vaadin and Magnolia
Highly Scalable User Experience Design: Vaadin and MagnoliaHighly Scalable User Experience Design: Vaadin and Magnolia
Highly Scalable User Experience Design: Vaadin and Magnolia
 
Client Side MVC with Backbone and Rails
Client Side MVC with Backbone and RailsClient Side MVC with Backbone and Rails
Client Side MVC with Backbone and Rails
 
Angular JS, A dive to concepts
Angular JS, A dive to conceptsAngular JS, A dive to concepts
Angular JS, A dive to concepts
 
Prism Tech Ed India
Prism Tech Ed IndiaPrism Tech Ed India
Prism Tech Ed India
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012
 
Dreamforce 2017 - Up close and personal with Lightning Experience as Platform
Dreamforce 2017 - Up close and personal with Lightning Experience as PlatformDreamforce 2017 - Up close and personal with Lightning Experience as Platform
Dreamforce 2017 - Up close and personal with Lightning Experience as Platform
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Porting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application GuidancePorting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application Guidance
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 

More from Kseniya Redunova

Estimates: is there a silver bullet?
Estimates: is there a silver bullet?Estimates: is there a silver bullet?
Estimates: is there a silver bullet?
Kseniya Redunova
 
ECMAScript: past, present and future
ECMAScript: past, present and futureECMAScript: past, present and future
ECMAScript: past, present and future
Kseniya Redunova
 
MarionetteJS. Shall we dance?
MarionetteJS. Shall we dance?MarionetteJS. Shall we dance?
MarionetteJS. Shall we dance?
Kseniya Redunova
 
Stylish visualisations with D3.js (OdessaJS)
Stylish visualisations with D3.js (OdessaJS)Stylish visualisations with D3.js (OdessaJS)
Stylish visualisations with D3.js (OdessaJS)Kseniya Redunova
 
JavaScript design patterns overview
JavaScript design patterns overview JavaScript design patterns overview
JavaScript design patterns overview
Kseniya Redunova
 
RaphaëlJS magic
RaphaëlJS magicRaphaëlJS magic
RaphaëlJS magic
Kseniya Redunova
 

More from Kseniya Redunova (6)

Estimates: is there a silver bullet?
Estimates: is there a silver bullet?Estimates: is there a silver bullet?
Estimates: is there a silver bullet?
 
ECMAScript: past, present and future
ECMAScript: past, present and futureECMAScript: past, present and future
ECMAScript: past, present and future
 
MarionetteJS. Shall we dance?
MarionetteJS. Shall we dance?MarionetteJS. Shall we dance?
MarionetteJS. Shall we dance?
 
Stylish visualisations with D3.js (OdessaJS)
Stylish visualisations with D3.js (OdessaJS)Stylish visualisations with D3.js (OdessaJS)
Stylish visualisations with D3.js (OdessaJS)
 
JavaScript design patterns overview
JavaScript design patterns overview JavaScript design patterns overview
JavaScript design patterns overview
 
RaphaëlJS magic
RaphaëlJS magicRaphaëlJS magic
RaphaëlJS magic
 

Recently uploaded

Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 

Recently uploaded (20)

Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 

Marionette talk 2016

Editor's Notes

  1. -
  2. -
  3. -
  4. all JS frameworks have pros & cons no silver bullet choose the right tool depending on task
  5. -
  6. -
  7. -
  8. -
  9. Application wrapper for a plain Javascript object with a start() method. This can be used to accomplish tasks before the rest of your application begins. MyApp.on("before:start", function(options){ options.moreData = "…"; }); MyApp.on("start", function(options){ if (Backbone.history){ Backbone.history.start(); } }); -- Application regions This feature is deprecated. Instead of using the Application as the root of your view tree, you should use a Layout View. To scope your Layout View to the entire document, you could set its el to 'body'.
  10. V2.0 Modularity is ok
  11. -
  12. Several types of views; bb has the only one – not flexible Auto render on model change – will show later Close() method helps avoiding memory leaks
  13. Underscore – by default Handlebars templates have logic Template helpers help making templates smarter When this attribute is present - its contents will be mixed in to the data object - from the serializeData method. Create helper methods that can be called from within the templates. As calculated values.
  14. Prefix the data you need with "this". Gives you all of the methods and attributes of the serialized data object, including the other helper methods. So helper methods can be called from the templates
  15. For one element
  16. Is cached attributes which are mapped to jq object (alias) To access the same UI element more than once in your view's code. simply reference it by this.ui.alias
  17. For collection’s add/remove/sort – renders through documentFragment loop through all of the models in the collection, render each of them using a specified childView, then append the results of the child view's el to the collection view's el. By default the CollectionView will maintain a sorted collection's order in the DOM. This behavior can be disabled by specifying {sort: false} on initialize.
  18. -
  19. Collection with a template: - both a branch and leaf in a tree structure - a collection needs to be rendered within a wrapper template
  20. Similar to the events hash, views can specify a configuration hash for collections and models.
  21. how to deal with zombie views
  22. How many alerts can we see? Instance 1 of zombieView out of scope after the 2nd is created JS garbage collector can delete 1st instance -> zombieView should get inactive and stop listening to model events But we get 2 alerts! Due to model event listener: this.render -> ‘on’ callback => model saves direct link to view instance So both views react to model events Solve that: in bb – set method close(), clean/unbind/stopListening In Marionette: regions! --- Вопрос: сколько alert() мы увидим? Поскольку мы используем переменную zombieView для обоих экземпляров представления, первый экземпляр окажется вне области видимости сразу после создания второго экземпляра. Это даст возможность «сборщику мусора» JavaScript уничтожить первый экземпляр, в результате чего представление утратит активность и перестанет реагировать на события изменения модели. Тем не менее если мы запустим этот код, то увидим окно дважды! Эта проблема вызвана привязкой события модели в методе initialize view. Каждый раз, когда мы передаем this.render в качестве функции callback методу on модели, сама модель получает прямую ссылку на экземпляр view. Наличие этой ссылки в модели приводит к тому, что при присваивании нового экземпляра представления переменной zombieView первое представление остается в области видимости. Поскольку второе представление появляется в области видимости в тот момент, когда первое представление продолжает находиться в ней, оба представления реагируют на изменение данных модели.
  23. Regions provide consistent methods to manage, show and destroy views. We bind it to DOM el and it renders view there Using the LayoutView class you can create nested regions.
  24. auto destroy()
  25. -
  26. You can also add regions via LayoutViews To scope your Layout View to the entire document, you could set its el to 'body'. This might look something like the following: var RootView = Marionette.LayoutView.extend({ el: 'body', regions: {menu: ‘#menu’, ….} }); attach an instance of the RootView to your Application instance. app.rootView = new RootView();
  27. Event-driven architecture bb.Wreqr – old – deprecated in M3 bb.Radio – isn’t a dependency yet; small snippet to include -- Clone this repository or install via Bower or npm. bower install backbone.radio npm install backbone.radio A shim to replace Backbone.Wreqr with Backbone.Radio in Marionette. Requires Marionette v2.1+
  28. software architecture model for communicating between two systems. The idea is that instead of referencing each other directly, system components are able to send messages through a shared mediator object. 3 types of events More complex events comparing to bb -- Application.vent - instance of Backbone.Wreqr.EventAggregator. pub/sub. Application.commands - instance of Backbone.Wreqr.Commands. Подписаться на исполнение команды - 1 раз Application.reqres - instance of Backbone.Wreqr.RequestResponse. Исполняет запрос только один подписчик
  29. Mediator object Passively sharing info between the pieces of an app when events occur Global – we can go the wrong way Add namespaces to events – help sorting things out
  30. Application.vent - instance of Backbone.Wreqr.EventAggregator.
  31. Command pattern Application.commands – instance of Backbone.Wreqr.Commands During 2015, Commands were deprecated from Backbone.Radio as part of their 1.0.0 release. From a code level, they're simply a request that doesn't return a value, so feel free to keep any existing code, but change command to request and comply to reply. Commands do not add any functionality on top of events; instead, they provide a semantic distinction and enforce simpler logic.
  32. setHandler; execute; -- var commands = new Backbone.Wreqr.Commands(); commands.setHandler("foo", function(){ console.log("the foo command was executed"); }); commands.execute(“foo");
  33. Requests the status of some object in app Application.reqres – instance of Backbone.Wreqr.RequestResponse. * The difference between Events and Requests is that Requests have intention. Requests are asking for a very specific thing to occur. * The requests are 'one-to-one,' so you cannot have multiple 'listeners' to a single request * Easy to misuse - like other global objects -- _.extend(myView, Backbone.Radio.Requests);
  34. --- var reqres = new Backbone.Wreqr.RequestResponse(); // Set up an object to reply to a request. In this case, // whether or not its visible. myObject.reply('visible', this.isVisible); // Get whether it's visible or not. var isViewVisible = myObject.request('visible');
  35. Radio vs wreqr: channels A Channel is simply an object that has Backbone.Events and Radio.Requests mixed into it: it's a standalone message bus comprised of both systems.
  36. -
  37. -
  38. -
  39. -