SlideShare uma empresa Scribd logo
1 de 25
an architecture for
reactive programming
MVI
HELLO!
I am Luca Mezzalira
Solutions Architect @ DAZN
Google Developer Expert on Web Technologies
Community Manager of London JavaScript User Group
AGENDA
▸ Reactive programming
▸ Model - View - Intent
▸ Cycle.js
1.
REACTIVE
PROGRAMMING
PROGRAMMING PARADIGMS
FUNCTIONAL
It is a declarative
programming paradigm,
which means
programming is done
with expressions. In
functional code, the
output value of a
function depends only
on the arguments that
are input to the
function, so calling a
function f twice with the
same value for an
argument x will produce
the same result f(x)
each time.
IMPERATIVE
It is a programming
paradigm that uses
statements that change
a program's state. In
much the same way that
the imperative mood in
natural languages
expresses commands, an
imperative program
consists of commands
for the computer to
perform. Imperative
programming focuses
on describing how a
program operates.
REACTIVE
It is a programming
paradigm oriented
around data flows and
the propagation of
change. This means that
it should be possible to
express static or
dynamic data flows with
ease in the programming
languages used, and that
the underlying execution
model will automatically
propagate changes
through the data flow.
PASSIVE REACTIVE
BA BA
Imperative vs Reactive
OBSERVER PATTERN
The observer pattern is a software design pattern in which an object,
called the subject, maintains a list of its dependents, called
observers, and notifies them automatically of any state changes,
usually by calling one of their methods. It is mainly used to implement
distributed event handling systems.
STREAMS
A stream is a sequence of ongoing events
ordered in time. It can emit three different
things: a value (of some type), an error, or a
"completed" signal.
EVERYTHING CAN BE A STREAM
2.
MODEL VIEW
INTENT
VIEW MODELPRESENTER
https://en.wikipedia.org/wiki/Model-view-presenter
VIEW INTENT
MODEL
RENDERER
futurice.com/blog/reactive-mvc-and-the-virtual-dom
VIEWInput: data events from the Model.
Output: a Virtual DOM rendering of the model,
and raw user input events (such as clicks,
keyboard typing, accelerometer events, etc).
VIEW
RENDERER
INTENTInput: raw user input events from the View.
Output: model-friendly user intention events.
INTENT
MODELInput: user interaction events from the Intent.
Output: data events.
MODEL
MVI RULES
▸ A module shouldn’t control
any other module (controller
in MVC)
▸ The only shared part between
modules are observables
▸ Intent is a component with
only one responsibility: It
should interpret what the
user is trying to do in terms
of model updates, and export
these "user intentions" as
events
3.
Cycle.js
Cycle.js
Core concepts
▸ Pure Functions
▸ Streams
▸ Components
▸ Drivers
DRIVERS
Drivers are functions that listen to
Observable sinks (their input), perform
imperative side effects, and may return
Observable sources (their output).
http://cycle.js.org/drivers.html
Cycle.js DOMDriver
Cycle Diversity
▸ Refactored in Typescript
▸ It accepts different type of
reactive libraries (xstream,
rxjs 4 and 5, most)
▸ Integration with Snabbdom
for DOM rendering by default
https://github.com/cyclejs/cyclejs/releases/tag/v7.0.0
React-Native
React
https://github.com/cyclejs/cycle-react-native
https://github.com/pH200/cycle-react
Snabbdom-jsx
https://github.com/yelouafi/snabbdom-jsx
Cycle.js in action
Shall we use
Reactive Programming
in any project?
@lucamezzalira
github.com/lucamezzalira
www.lucamezzalira.com
mezzalab@gmail.com

Mais conteúdo relacionado

Semelhante a Mvi an architecture for reactive programming

Binary code obfuscation through c++ template meta programming
Binary code obfuscation through c++ template meta programmingBinary code obfuscation through c++ template meta programming
Binary code obfuscation through c++ template meta programming
nong_dan
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
Ashwini Awatare
 
Programming Concepts 01
Programming Concepts 01Programming Concepts 01
Programming Concepts 01
Learn 2 Be
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
Ashesh R
 

Semelhante a Mvi an architecture for reactive programming (20)

Software design
Software designSoftware design
Software design
 
Book management system
Book management systemBook management system
Book management system
 
Binary code obfuscation through c++ template meta programming
Binary code obfuscation through c++ template meta programmingBinary code obfuscation through c++ template meta programming
Binary code obfuscation through c++ template meta programming
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScript
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reaction
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reaction
 
HCI 3e - Ch 8: Implementation support
HCI 3e - Ch 8:  Implementation supportHCI 3e - Ch 8:  Implementation support
HCI 3e - Ch 8: Implementation support
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reaction
 
Training 8051Report
Training 8051ReportTraining 8051Report
Training 8051Report
 
Programming Concepts 01
Programming Concepts 01Programming Concepts 01
Programming Concepts 01
 
Architectural Design Pattern: Android
Architectural Design Pattern: AndroidArchitectural Design Pattern: Android
Architectural Design Pattern: Android
 
GMR PROJECT PPT
GMR PROJECT PPTGMR PROJECT PPT
GMR PROJECT PPT
 
Pattern oriented architecture for web based architecture
Pattern oriented architecture for web based architecturePattern oriented architecture for web based architecture
Pattern oriented architecture for web based architecture
 
Tutorial 37 API Coding
Tutorial 37 API CodingTutorial 37 API Coding
Tutorial 37 API Coding
 
Mvc ppt
Mvc pptMvc ppt
Mvc ppt
 
Wecreate
WecreateWecreate
Wecreate
 
Problem Solving Techniques
Problem Solving TechniquesProblem Solving Techniques
Problem Solving Techniques
 
06 fse design
06 fse design06 fse design
06 fse design
 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
 

Mais de luca mezzalira

Having fun with Adobe AIR 2013
Having fun with Adobe AIR 2013Having fun with Adobe AIR 2013
Having fun with Adobe AIR 2013
luca mezzalira
 
Sviluppo di contenuti Flash Platform su iOS e Android
Sviluppo di contenuti Flash Platform su iOS e AndroidSviluppo di contenuti Flash Platform su iOS e Android
Sviluppo di contenuti Flash Platform su iOS e Android
luca mezzalira
 
Actionscript 3 Design Pattern
Actionscript 3 Design PatternActionscript 3 Design Pattern
Actionscript 3 Design Pattern
luca mezzalira
 
Flash Platform & Android
Flash Platform & AndroidFlash Platform & Android
Flash Platform & Android
luca mezzalira
 

Mais de luca mezzalira (11)

Evolution of front end architectures
Evolution of front end architecturesEvolution of front end architectures
Evolution of front end architectures
 
Kaizen - the key of continuos improvement
Kaizen - the key of continuos improvementKaizen - the key of continuos improvement
Kaizen - the key of continuos improvement
 
Having fun with Adobe AIR 2013
Having fun with Adobe AIR 2013Having fun with Adobe AIR 2013
Having fun with Adobe AIR 2013
 
Flash Platform su dispositivi mobili
Flash Platform su dispositivi mobiliFlash Platform su dispositivi mobili
Flash Platform su dispositivi mobili
 
Flash Platform Ovierview
Flash Platform OvierviewFlash Platform Ovierview
Flash Platform Ovierview
 
Using design pattern for mobile
Using design pattern for mobileUsing design pattern for mobile
Using design pattern for mobile
 
Sviluppo di contenuti Flash Platform su iOS e Android
Sviluppo di contenuti Flash Platform su iOS e AndroidSviluppo di contenuti Flash Platform su iOS e Android
Sviluppo di contenuti Flash Platform su iOS e Android
 
Actionscript 3 Design Pattern
Actionscript 3 Design PatternActionscript 3 Design Pattern
Actionscript 3 Design Pattern
 
Flash Platform & Android
Flash Platform & AndroidFlash Platform & Android
Flash Platform & Android
 
Adobe AIR & Printing
Adobe AIR & PrintingAdobe AIR & Printing
Adobe AIR & Printing
 
Android Development with Flash Platform
Android Development with Flash PlatformAndroid Development with Flash Platform
Android Development with Flash Platform
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Mvi an architecture for reactive programming