SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
REACTIVE
PROGRAMMING
Ryan Stout, June 2014
WHAT IS
“REACTIVE”
Ryan Stout, June 2014
a buzzword
WHAT IS
“REACTIVE”
Ryan Stout, June 2014
data flows
data bindings
evented programming
actor model
stream processing
fault tolerence
WHY YOUR
WASTING YOUR LIFE
Ryan Stout, June 2014
IS IT ME OR DOES WEB
DEVELOPMENT STILL
SUCK?
Ryan Stout, June 2014
IF I HAVE TO WRITE ONE
MORE REST API, I’M GOING
TO END IT ALL
Ryan Stout, June 2014
MANAGING STATE WITH
REACTIVE PROGRAMMING
Ryan Stout, June 2014
WHERE IS AN
APP’S STATE?
Ryan Stout, June 2014
Browser (URL)
!
!
!
!
!
!
JS
!
!
!
!
!
DOM
!
!
!
Server
!
!
!
!
!
!
App
!
!
!
!
!
Database
!
!
!
Rows
Models
Fields/HTML
Models
JSON
POST PARAMS
URL/Params
WEB DEVELOPER:
Someone who moves data
from one place to another
Ryan Stout, June 2014
FRONT END STATE
Ryan Stout, June 2014
Browser (URL)
!
!
!
!
!
!
JS
!
!
!
!
!
DOM
!
!
!
REACTIVE BINDINGS
Ryan Stout, June 2014
Browser (URL)
!
!
!
!
!
!
JS
!
!
!
!
!
DOM
!
!
!
<script>

var user = {

name: 'Ryan'

};



// Change name

user.name = 'Bob';



// Print if changed

console.log(user.name);

</script>



<form>

<input type="text" value="{user.name}" />

</form>
ARRAY BINDINGS
Ryan Stout, June 2014
<script>

var todos = [];



todos.push({label: 'Get users'});

todos.push({label: 'Don't bring in revenue'});

todos.push({label: 'Sell for billions to Facebook'});

</script>



{#each todos as todo}

<p>{todo.label}</p>

{/}
COMPUTED PROPERTIES
Ryan Stout, June 2014
<script>

var mealCost = 65;

var numberOfPeople = 4;

var personShare = mealCost / numberOfPeople;

</script>



<form>

<p>Meal Cost: <input type="text" value="{mealCost}" /></p>

<p>Number of People: <input type="text" value="{numberOfPeople}" /></p>

<p>Share Per Person: {personShare}</p>

</form>
COMPUTED PROPERTIES
Ryan Stout, June 2014
<script>

var index = 0;

var todos = [{label: 'Buy Milk'}, {label: 'Fix Car'}];

var currentTodo = todos[index];

</script>



<p>Index: <input type="text" value="{index}" /></p>



<h1>{currentTodo.label}</h1>



API STRATEGIES
Ryan Stout, June 2014
virtual dom
!
dom diff
checking
!
one-way
bindings
proxy objects
!
explicit function
dependencies
!
computation
dependency
graph
diff check scope
object
!
dependency
graph via
dependency
injection
VOLT
Ryan Stout, June 2014
BAIT & SWITCH
Ryan Stout, June 2014
WHAT IS VOLT?
Ryan Stout, June 2014
web framework
ruby on back-end
!
ruby on front-end
(compiled to JS with Opal)
!
share code between front and back end
reactive bindings
data synchronization
DEMO
Ryan Stout, June 2014
WHERE IS AN
APP’S STATE?
Ryan Stout, June 2014
Browser (URL)
!
!
!
!
!
!
JS
!
!
!
!
!
DOM
!
!
!
Server
!
!
!
!
!
!
App
!
!
!
!
!
Database
!
!
!
Rows
Models
Fields/HTML
Models
JSON
POST PARAMS
URL/Params
Models
THANKS!
Ryan Stout, June 2014
Volt: github.com/voltrb/volt
React: facebook.github.io/react
Ember: emberjs.com
Angular: angularjs.org
!

Mais conteúdo relacionado

Mais procurados

Hateoas APIs are about relationships
Hateoas APIs are about relationshipsHateoas APIs are about relationships
Hateoas APIs are about relationships
Matt Bishop
 

Mais procurados (17)

Our path to apache spark
Our path to apache sparkOur path to apache spark
Our path to apache spark
 
Compassionate (Yet Candid) Code Reviews
Compassionate (Yet Candid) Code ReviewsCompassionate (Yet Candid) Code Reviews
Compassionate (Yet Candid) Code Reviews
 
Being an Apache Kafka Developer Hero in the World of Cloud (Ricardo Ferreira,...
Being an Apache Kafka Developer Hero in the World of Cloud (Ricardo Ferreira,...Being an Apache Kafka Developer Hero in the World of Cloud (Ricardo Ferreira,...
Being an Apache Kafka Developer Hero in the World of Cloud (Ricardo Ferreira,...
 
Mejorando las busquedas en nuestras aplicaciones web con elasticsearch
Mejorando las busquedas en nuestras aplicaciones web con elasticsearchMejorando las busquedas en nuestras aplicaciones web con elasticsearch
Mejorando las busquedas en nuestras aplicaciones web con elasticsearch
 
Putting to your Robots to Work V1.1
Putting to your Robots to Work V1.1Putting to your Robots to Work V1.1
Putting to your Robots to Work V1.1
 
2018 Charlottesville Open Data Challenge - Alex Miller
2018 Charlottesville Open Data Challenge - Alex Miller2018 Charlottesville Open Data Challenge - Alex Miller
2018 Charlottesville Open Data Challenge - Alex Miller
 
Schema Markup Basics - Pubcon 2017
Schema Markup Basics - Pubcon 2017Schema Markup Basics - Pubcon 2017
Schema Markup Basics - Pubcon 2017
 
Hateoas APIs are about relationships
Hateoas APIs are about relationshipsHateoas APIs are about relationships
Hateoas APIs are about relationships
 
Compassionate Coding for Bootcampers
Compassionate Coding for BootcampersCompassionate Coding for Bootcampers
Compassionate Coding for Bootcampers
 
Low Friction Personal Data Collection - Quantified Self Global Conference 2013
Low Friction Personal Data Collection - Quantified Self Global Conference 2013Low Friction Personal Data Collection - Quantified Self Global Conference 2013
Low Friction Personal Data Collection - Quantified Self Global Conference 2013
 
Twitter APIs - the starter guide
Twitter APIs - the starter guideTwitter APIs - the starter guide
Twitter APIs - the starter guide
 
Conexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraConexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização Prematura
 
Your government is Mashed UP!
Your government is Mashed UP!Your government is Mashed UP!
Your government is Mashed UP!
 
Premature optimisation: The Root of All Evil
Premature optimisation: The Root of All EvilPremature optimisation: The Root of All Evil
Premature optimisation: The Root of All Evil
 
Powering Content Driven Applications with the World’s Most Popular CMS #ngconf
Powering Content Driven Applications with the World’s Most Popular CMS #ngconfPowering Content Driven Applications with the World’s Most Popular CMS #ngconf
Powering Content Driven Applications with the World’s Most Popular CMS #ngconf
 
Ryan jarrell resume
Ryan jarrell resumeRyan jarrell resume
Ryan jarrell resume
 
Riot Games - Player Focused Pipeline - Stampedecon 2015
Riot Games - Player Focused Pipeline - Stampedecon 2015Riot Games - Player Focused Pipeline - Stampedecon 2015
Riot Games - Player Focused Pipeline - Stampedecon 2015
 

Mais de ryanstout (8)

Neural networks - BigSkyDevCon
Neural networks - BigSkyDevConNeural networks - BigSkyDevCon
Neural networks - BigSkyDevCon
 
Volt 2015
Volt 2015Volt 2015
Volt 2015
 
Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014
 
Concurrency Patterns
Concurrency PatternsConcurrency Patterns
Concurrency Patterns
 
EmberJS
EmberJSEmberJS
EmberJS
 
Practical Machine Learning and Rails Part2
Practical Machine Learning and Rails Part2Practical Machine Learning and Rails Part2
Practical Machine Learning and Rails Part2
 
Practical Machine Learning and Rails Part1
Practical Machine Learning and Rails Part1Practical Machine Learning and Rails Part1
Practical Machine Learning and Rails Part1
 
Intro to Advanced JavaScript
Intro to Advanced JavaScriptIntro to Advanced JavaScript
Intro to Advanced JavaScript
 

Último

Último (20)

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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Reactive programming

  • 2. WHAT IS “REACTIVE” Ryan Stout, June 2014 a buzzword
  • 3. WHAT IS “REACTIVE” Ryan Stout, June 2014 data flows data bindings evented programming actor model stream processing fault tolerence
  • 4. WHY YOUR WASTING YOUR LIFE Ryan Stout, June 2014
  • 5. IS IT ME OR DOES WEB DEVELOPMENT STILL SUCK? Ryan Stout, June 2014
  • 6. IF I HAVE TO WRITE ONE MORE REST API, I’M GOING TO END IT ALL Ryan Stout, June 2014
  • 7. MANAGING STATE WITH REACTIVE PROGRAMMING Ryan Stout, June 2014
  • 8. WHERE IS AN APP’S STATE? Ryan Stout, June 2014 Browser (URL) ! ! ! ! ! ! JS ! ! ! ! ! DOM ! ! ! Server ! ! ! ! ! ! App ! ! ! ! ! Database ! ! ! Rows Models Fields/HTML Models JSON POST PARAMS URL/Params
  • 9. WEB DEVELOPER: Someone who moves data from one place to another Ryan Stout, June 2014
  • 10.
  • 11. FRONT END STATE Ryan Stout, June 2014 Browser (URL) ! ! ! ! ! ! JS ! ! ! ! ! DOM ! ! !
  • 12. REACTIVE BINDINGS Ryan Stout, June 2014 Browser (URL) ! ! ! ! ! ! JS ! ! ! ! ! DOM ! ! ! <script>
 var user = {
 name: 'Ryan'
 };
 
 // Change name
 user.name = 'Bob';
 
 // Print if changed
 console.log(user.name);
 </script>
 
 <form>
 <input type="text" value="{user.name}" />
 </form>
  • 13. ARRAY BINDINGS Ryan Stout, June 2014 <script>
 var todos = [];
 
 todos.push({label: 'Get users'});
 todos.push({label: 'Don't bring in revenue'});
 todos.push({label: 'Sell for billions to Facebook'});
 </script>
 
 {#each todos as todo}
 <p>{todo.label}</p>
 {/}
  • 14. COMPUTED PROPERTIES Ryan Stout, June 2014 <script>
 var mealCost = 65;
 var numberOfPeople = 4;
 var personShare = mealCost / numberOfPeople;
 </script>
 
 <form>
 <p>Meal Cost: <input type="text" value="{mealCost}" /></p>
 <p>Number of People: <input type="text" value="{numberOfPeople}" /></p>
 <p>Share Per Person: {personShare}</p>
 </form>
  • 15. COMPUTED PROPERTIES Ryan Stout, June 2014 <script>
 var index = 0;
 var todos = [{label: 'Buy Milk'}, {label: 'Fix Car'}];
 var currentTodo = todos[index];
 </script>
 
 <p>Index: <input type="text" value="{index}" /></p>
 
 <h1>{currentTodo.label}</h1>
 

  • 16. API STRATEGIES Ryan Stout, June 2014 virtual dom ! dom diff checking ! one-way bindings proxy objects ! explicit function dependencies ! computation dependency graph diff check scope object ! dependency graph via dependency injection
  • 18. BAIT & SWITCH Ryan Stout, June 2014
  • 19. WHAT IS VOLT? Ryan Stout, June 2014 web framework ruby on back-end ! ruby on front-end (compiled to JS with Opal) ! share code between front and back end reactive bindings data synchronization
  • 21. WHERE IS AN APP’S STATE? Ryan Stout, June 2014 Browser (URL) ! ! ! ! ! ! JS ! ! ! ! ! DOM ! ! ! Server ! ! ! ! ! ! App ! ! ! ! ! Database ! ! ! Rows Models Fields/HTML Models JSON POST PARAMS URL/Params Models
  • 22. THANKS! Ryan Stout, June 2014 Volt: github.com/voltrb/volt React: facebook.github.io/react Ember: emberjs.com Angular: angularjs.org !