SlideShare une entreprise Scribd logo
1  sur  21
Reactive Programming
Nick Hodge
Developer, Geek
nhodge@mungr.com
http://nickhodge.com/
https://gist.github.com/nickhodge for codesnippets
Who is Nick Hodge?
• 28 years in IT, mostly as non-Developer
• Apple, Adobe, Microsoft
• Many small-scale, rapidly built applications
• Open source contributor
• Functional Reactive Programming Fan
Group Experiment:
Data-at-rest vs. Data-in-motion
• LINQ to IEnumerable (or IQueryable)
• “data at rest”
• yield
• What happens if data changes in midst of foreach() ?
• Reactive programming (IObservable)
• “data in motion”
• Data (or events) are pushed at you
Reactive Programming
demo required
Reactive Programming vs. TPL
• Task Parallel Library (TPL) http://msdn.microsoft.com/en-
us/concurrency
• PLINQ
The core of LINQ
is the sequence
A sequence is just
some stuff in a particular order
What about Rx?
Let’s talk about events
Limitations of .NET Events
exchange.StockTick += (sender, args) =>
{
if (args.Quote.Symbol == “MSFT”)
{
// Imperative code
}
};
exchange.StockTick -= /* what goes here? */;
Observable Sequences to the Rescue
IObservable<Quote> stockQuotes = …;
var msft = stockQuotes
.Where(quote => quote.Symbol == “MSFT”);
var subscription = msft.Subscribe(quote => /* … */);
subscription.Dispose();
Are .NET Events Obsolete?
• .NET Events
• Code centric
• Design-time experience
• Not first class
• Non-compositional
• Lightweight
• Rigid execution model (IL)
• Observables
• Data centric
• No design-time experience
• First class objects
• Rich composition
• Slightly more cost
• Translatable with expression trees
The Event Processing Landscape
Social
media
RSS feeds
GPS
Server management
Reactive Extensions Architecture
Event Streams
• Towards a unified programming model
• Producers are observable sequences
• .NET events, WinRT events, sensor APIs, APM methods, tasks, etc.
• Consumers are observers
• Hooking up “continuations” or handlers
Observable
Subscribe
Observer
Essential Interfaces
namespace System
{
public interface IObservable<out T>
{
IDisposable Subscribe(IObserver<T> observer);
}
public interface IObserver<in T>
{
void OnNext(T value);
void OnError(Exception error);
void OnCompleted();
}
}
Observable Sources
• Single items / empty Observable.Return()
• Lists and arrays
• UI Events
• Async methods
• Subjects (demo)
• Property Changes
Cold / Hot
• Hot : example MouseMove
• Cold: when you subscribe, something happens (it waits)
UI Example, Windows 8 Universal App
This Presentation’s Reference Presentations
• Bart De Smet “Curing Your Event Processing Blues with Reactive
Extensions (Rx)” TechEd Europe 2012
http://channel9.msdn.com/events/TechEd/Europe/2012/DEV413
• Paul Betts “Introduction to Reactive Extensions” Norwegian
Developer’s Conference 2012 http://vimeo.com/43659034
• Brendan Forster “Reactive UI – Turning MVVM up to 11”
http://vimeo.com/97329155
Further References, Links
• https://rx.codeplex.com/ and https://github.com/Reactive-
Extensions/Rx.NET as the starting point
• RxJS (and other languages such as Ruby, C++, Python, Java, ObjC)
https://github.com/Reactive-Extensions/RxJS
• http://www.introtorx.com/
• 101 Rx Examples
http://rxwiki.wikidot.com/101samples
• http://amzn.to/programming-rx “Programming Reactive Extensions
and LINQ”
Further Research, Future
• “Scalable Information Stream Processing by Bing in Support of
Cortana Scenarios” http://channel9.msdn.com/posts/Scalable-
Information-Stream-Processing-by-Bing-in-Support-of-Cortana-
Scenarios
• Actor model, “Microsoft Research project Orleans simplify
development of scalable cloud services”
http://channel9.msdn.com/Shows/Cloud+Cover/Episode-142-
Microsoft-Research-project-Orleans-simplify-development-of-
scalable-cloud-services

Contenu connexe

Tendances

Demystifying Reactive Programming
Demystifying Reactive ProgrammingDemystifying Reactive Programming
Demystifying Reactive ProgrammingTom Bulatewicz, PhD
 
Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaNexThoughts Technologies
 
Declarative Concurrency with Reactive Programming
Declarative Concurrency with Reactive ProgrammingDeclarative Concurrency with Reactive Programming
Declarative Concurrency with Reactive ProgrammingFlorian Stefan
 
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project ReactorReactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project ReactorKnoldus Inc.
 
Introduction to Reactive programming
Introduction to Reactive programmingIntroduction to Reactive programming
Introduction to Reactive programmingDwi Randy Herdinanto
 
Reactive programming - Observable
Reactive programming - ObservableReactive programming - Observable
Reactive programming - ObservableDragos Ionita
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programmingHung Hoang
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive ProgrammingAndres Almiray
 
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Threading Made Easy! A Busy Developer’s Guide to Kotlin CoroutinesThreading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Threading Made Easy! A Busy Developer’s Guide to Kotlin CoroutinesLauren Yew
 
Quick Tour On Zeppelin
Quick Tour On ZeppelinQuick Tour On Zeppelin
Quick Tour On ZeppelinKnoldus Inc.
 
Introduction to Akka Streams
Introduction to Akka StreamsIntroduction to Akka Streams
Introduction to Akka StreamsKnoldus Inc.
 
Building Reactive webapp with React/Flux
Building Reactive webapp with React/FluxBuilding Reactive webapp with React/Flux
Building Reactive webapp with React/FluxKeuller Magalhães
 
Portable Streaming Pipelines with Apache Beam
Portable Streaming Pipelines with Apache BeamPortable Streaming Pipelines with Apache Beam
Portable Streaming Pipelines with Apache Beamconfluent
 
Srivalli Aparna - The Blueprints to Success
Srivalli Aparna - The Blueprints to SuccessSrivalli Aparna - The Blueprints to Success
Srivalli Aparna - The Blueprints to SuccessNeotys_Partner
 
Prometheus Introduction (InfraCoders Vienna)
Prometheus Introduction (InfraCoders Vienna)Prometheus Introduction (InfraCoders Vienna)
Prometheus Introduction (InfraCoders Vienna)Oliver Moser
 

Tendances (20)

Demystifying Reactive Programming
Demystifying Reactive ProgrammingDemystifying Reactive Programming
Demystifying Reactive Programming
 
Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJava
 
Declarative Concurrency with Reactive Programming
Declarative Concurrency with Reactive ProgrammingDeclarative Concurrency with Reactive Programming
Declarative Concurrency with Reactive Programming
 
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project ReactorReactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project Reactor
 
Introduction to Reactive programming
Introduction to Reactive programmingIntroduction to Reactive programming
Introduction to Reactive programming
 
Project Reactor By Example
Project Reactor By ExampleProject Reactor By Example
Project Reactor By Example
 
Reactive programming - Observable
Reactive programming - ObservableReactive programming - Observable
Reactive programming - Observable
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programming
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
 
Mini-Training: Let's have a rest
Mini-Training: Let's have a restMini-Training: Let's have a rest
Mini-Training: Let's have a rest
 
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Threading Made Easy! A Busy Developer’s Guide to Kotlin CoroutinesThreading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
 
Quick Tour On Zeppelin
Quick Tour On ZeppelinQuick Tour On Zeppelin
Quick Tour On Zeppelin
 
Introduction to Akka Streams
Introduction to Akka StreamsIntroduction to Akka Streams
Introduction to Akka Streams
 
Flux architecture
Flux architectureFlux architecture
Flux architecture
 
Building Reactive webapp with React/Flux
Building Reactive webapp with React/FluxBuilding Reactive webapp with React/Flux
Building Reactive webapp with React/Flux
 
Flux and React.js
Flux and React.jsFlux and React.js
Flux and React.js
 
Portable Streaming Pipelines with Apache Beam
Portable Streaming Pipelines with Apache BeamPortable Streaming Pipelines with Apache Beam
Portable Streaming Pipelines with Apache Beam
 
Srivalli Aparna - The Blueprints to Success
Srivalli Aparna - The Blueprints to SuccessSrivalli Aparna - The Blueprints to Success
Srivalli Aparna - The Blueprints to Success
 
Prometheus Introduction (InfraCoders Vienna)
Prometheus Introduction (InfraCoders Vienna)Prometheus Introduction (InfraCoders Vienna)
Prometheus Introduction (InfraCoders Vienna)
 
Reactive Streams
Reactive StreamsReactive Streams
Reactive Streams
 

Similaire à Reactive programming

Quick look in Reactive Extensions
Quick look in Reactive ExtensionsQuick look in Reactive Extensions
Quick look in Reactive Extensionsjohnlvidal
 
Workshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive StreamsWorkshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive StreamsKristof Van Sever
 
Workshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive StreamsWorkshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive Streamssterkje
 
Rider - Taking ReSharper out of Process
Rider - Taking ReSharper out of ProcessRider - Taking ReSharper out of Process
Rider - Taking ReSharper out of Processcitizenmatt
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowKaxil Naik
 
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Maarten Balliauw
 
Geoscience and Microservices
Geoscience and Microservices Geoscience and Microservices
Geoscience and Microservices Matthew Gerring
 
Project Flogo: An Event-Driven Stack for the Enterprise
Project Flogo: An Event-Driven Stack for the EnterpriseProject Flogo: An Event-Driven Stack for the Enterprise
Project Flogo: An Event-Driven Stack for the EnterpriseLeon Stigter
 
Code PaLOUsa Azure IoT Workshop
Code PaLOUsa Azure IoT WorkshopCode PaLOUsa Azure IoT Workshop
Code PaLOUsa Azure IoT WorkshopMike Branstein
 
What’s expected in Spring 5
What’s expected in Spring 5What’s expected in Spring 5
What’s expected in Spring 5Gal Marder
 
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...Codemotion
 
Monitoring Big Data Systems "Done the simple way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems "Done the simple way" - Demi Ben-Ari - Codemotion...Monitoring Big Data Systems "Done the simple way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems "Done the simple way" - Demi Ben-Ari - Codemotion...Demi Ben-Ari
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without InterferenceTony Tam
 
Unite 2017 - Reactive Programming - Pieter Nijs
Unite 2017 - Reactive Programming - Pieter NijsUnite 2017 - Reactive Programming - Pieter Nijs
Unite 2017 - Reactive Programming - Pieter NijsN Core
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?GetInData
 
Dances with bits - industrial data analytics made easy!
Dances with bits - industrial data analytics made easy!Dances with bits - industrial data analytics made easy!
Dances with bits - industrial data analytics made easy!Julian Feinauer
 
Monitoring Big Data Systems - "The Simple Way"
Monitoring Big Data Systems - "The Simple Way"Monitoring Big Data Systems - "The Simple Way"
Monitoring Big Data Systems - "The Simple Way"Demi Ben-Ari
 
Has serverless adoption hit a roadblock?
Has serverless adoption hit a roadblock?Has serverless adoption hit a roadblock?
Has serverless adoption hit a roadblock?Veselin Pizurica
 
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...Jean Vanderdonckt
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive uiPaul van Zyl
 

Similaire à Reactive programming (20)

Quick look in Reactive Extensions
Quick look in Reactive ExtensionsQuick look in Reactive Extensions
Quick look in Reactive Extensions
 
Workshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive StreamsWorkshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive Streams
 
Workshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive StreamsWorkshop: Event-sourced system through Reactive Streams
Workshop: Event-sourced system through Reactive Streams
 
Rider - Taking ReSharper out of Process
Rider - Taking ReSharper out of ProcessRider - Taking ReSharper out of Process
Rider - Taking ReSharper out of Process
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...
 
Geoscience and Microservices
Geoscience and Microservices Geoscience and Microservices
Geoscience and Microservices
 
Project Flogo: An Event-Driven Stack for the Enterprise
Project Flogo: An Event-Driven Stack for the EnterpriseProject Flogo: An Event-Driven Stack for the Enterprise
Project Flogo: An Event-Driven Stack for the Enterprise
 
Code PaLOUsa Azure IoT Workshop
Code PaLOUsa Azure IoT WorkshopCode PaLOUsa Azure IoT Workshop
Code PaLOUsa Azure IoT Workshop
 
What’s expected in Spring 5
What’s expected in Spring 5What’s expected in Spring 5
What’s expected in Spring 5
 
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...
 
Monitoring Big Data Systems "Done the simple way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems "Done the simple way" - Demi Ben-Ari - Codemotion...Monitoring Big Data Systems "Done the simple way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems "Done the simple way" - Demi Ben-Ari - Codemotion...
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
 
Unite 2017 - Reactive Programming - Pieter Nijs
Unite 2017 - Reactive Programming - Pieter NijsUnite 2017 - Reactive Programming - Pieter Nijs
Unite 2017 - Reactive Programming - Pieter Nijs
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?
 
Dances with bits - industrial data analytics made easy!
Dances with bits - industrial data analytics made easy!Dances with bits - industrial data analytics made easy!
Dances with bits - industrial data analytics made easy!
 
Monitoring Big Data Systems - "The Simple Way"
Monitoring Big Data Systems - "The Simple Way"Monitoring Big Data Systems - "The Simple Way"
Monitoring Big Data Systems - "The Simple Way"
 
Has serverless adoption hit a roadblock?
Has serverless adoption hit a roadblock?Has serverless adoption hit a roadblock?
Has serverless adoption hit a roadblock?
 
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive ui
 

Plus de Nick Hodge

Virtual #appfest 18th Dec 2012
Virtual #appfest 18th Dec 2012Virtual #appfest 18th Dec 2012
Virtual #appfest 18th Dec 2012Nick Hodge
 
Victorian principals 17 may2007
Victorian principals 17 may2007Victorian principals 17 may2007
Victorian principals 17 may2007Nick Hodge
 
Telstra ux presentation 14 dec 2012
Telstra ux presentation 14 dec 2012Telstra ux presentation 14 dec 2012
Telstra ux presentation 14 dec 2012Nick Hodge
 
Technology and politics digital marketing v5
Technology and politics digital marketing v5Technology and politics digital marketing v5
Technology and politics digital marketing v5Nick Hodge
 
Technical windows 8 and windows phone 8 apps
Technical windows 8  and windows phone 8 appsTechnical windows 8  and windows phone 8 apps
Technical windows 8 and windows phone 8 appsNick Hodge
 
Tech ed au 2012 dev223
Tech ed au 2012 dev223Tech ed au 2012 dev223
Tech ed au 2012 dev223Nick Hodge
 
Tech ed au 2012 dev212
Tech ed au 2012 dev212Tech ed au 2012 dev212
Tech ed au 2012 dev212Nick Hodge
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPythonNick Hodge
 
Stealth PHP on IIS :-)
Stealth PHP on IIS :-)Stealth PHP on IIS :-)
Stealth PHP on IIS :-)Nick Hodge
 
Programming language crisis
Programming language crisisProgramming language crisis
Programming language crisisNick Hodge
 
Popfly mashups for the masses
Popfly mashups for the massesPopfly mashups for the masses
Popfly mashups for the massesNick Hodge
 
Php iis microsoft
Php iis microsoftPhp iis microsoft
Php iis microsoftNick Hodge
 
Osdc php preday odata 2011
Osdc php preday odata 2011Osdc php preday odata 2011
Osdc php preday odata 2011Nick Hodge
 
Nsw public sector architects
Nsw public sector architectsNsw public sector architects
Nsw public sector architectsNick Hodge
 
Mobile marketing
Mobile marketingMobile marketing
Mobile marketingNick Hodge
 
Microsoft gcio nsw 30 apr2008
Microsoft gcio nsw 30 apr2008Microsoft gcio nsw 30 apr2008
Microsoft gcio nsw 30 apr2008Nick Hodge
 
Microsoft and opensource ms ps 2011
Microsoft and opensource ms ps 2011Microsoft and opensource ms ps 2011
Microsoft and opensource ms ps 2011Nick Hodge
 
Mah tweets oss wp7
Mah tweets oss wp7Mah tweets oss wp7
Mah tweets oss wp7Nick Hodge
 

Plus de Nick Hodge (20)

Virtual #appfest 18th Dec 2012
Virtual #appfest 18th Dec 2012Virtual #appfest 18th Dec 2012
Virtual #appfest 18th Dec 2012
 
Victorian principals 17 may2007
Victorian principals 17 may2007Victorian principals 17 may2007
Victorian principals 17 may2007
 
Telstra ux presentation 14 dec 2012
Telstra ux presentation 14 dec 2012Telstra ux presentation 14 dec 2012
Telstra ux presentation 14 dec 2012
 
Technology and politics digital marketing v5
Technology and politics digital marketing v5Technology and politics digital marketing v5
Technology and politics digital marketing v5
 
Technical windows 8 and windows phone 8 apps
Technical windows 8  and windows phone 8 appsTechnical windows 8  and windows phone 8 apps
Technical windows 8 and windows phone 8 apps
 
Tech ed au 2012 dev223
Tech ed au 2012 dev223Tech ed au 2012 dev223
Tech ed au 2012 dev223
 
Tech ed au 2012 dev212
Tech ed au 2012 dev212Tech ed au 2012 dev212
Tech ed au 2012 dev212
 
SyPy IronPython
SyPy IronPythonSyPy IronPython
SyPy IronPython
 
Stealth PHP on IIS :-)
Stealth PHP on IIS :-)Stealth PHP on IIS :-)
Stealth PHP on IIS :-)
 
Prototyping
PrototypingPrototyping
Prototyping
 
Programming language crisis
Programming language crisisProgramming language crisis
Programming language crisis
 
Popfly mashups for the masses
Popfly mashups for the massesPopfly mashups for the masses
Popfly mashups for the masses
 
Php iis microsoft
Php iis microsoftPhp iis microsoft
Php iis microsoft
 
Osdc php preday odata 2011
Osdc php preday odata 2011Osdc php preday odata 2011
Osdc php preday odata 2011
 
Nsw public sector architects
Nsw public sector architectsNsw public sector architects
Nsw public sector architects
 
Mobile marketing
Mobile marketingMobile marketing
Mobile marketing
 
Microsoft gcio nsw 30 apr2008
Microsoft gcio nsw 30 apr2008Microsoft gcio nsw 30 apr2008
Microsoft gcio nsw 30 apr2008
 
Microsoft and opensource ms ps 2011
Microsoft and opensource ms ps 2011Microsoft and opensource ms ps 2011
Microsoft and opensource ms ps 2011
 
Mah tweets oss wp7
Mah tweets oss wp7Mah tweets oss wp7
Mah tweets oss wp7
 
Jaoo irony
Jaoo ironyJaoo irony
Jaoo irony
 

Dernier

Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 

Dernier (20)

Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 

Reactive programming

  • 1. Reactive Programming Nick Hodge Developer, Geek nhodge@mungr.com http://nickhodge.com/ https://gist.github.com/nickhodge for codesnippets
  • 2. Who is Nick Hodge? • 28 years in IT, mostly as non-Developer • Apple, Adobe, Microsoft • Many small-scale, rapidly built applications • Open source contributor • Functional Reactive Programming Fan
  • 3. Group Experiment: Data-at-rest vs. Data-in-motion • LINQ to IEnumerable (or IQueryable) • “data at rest” • yield • What happens if data changes in midst of foreach() ? • Reactive programming (IObservable) • “data in motion” • Data (or events) are pushed at you
  • 5. Reactive Programming vs. TPL • Task Parallel Library (TPL) http://msdn.microsoft.com/en- us/concurrency • PLINQ
  • 6. The core of LINQ is the sequence
  • 7. A sequence is just some stuff in a particular order
  • 8. What about Rx? Let’s talk about events
  • 9. Limitations of .NET Events exchange.StockTick += (sender, args) => { if (args.Quote.Symbol == “MSFT”) { // Imperative code } }; exchange.StockTick -= /* what goes here? */;
  • 10. Observable Sequences to the Rescue IObservable<Quote> stockQuotes = …; var msft = stockQuotes .Where(quote => quote.Symbol == “MSFT”); var subscription = msft.Subscribe(quote => /* … */); subscription.Dispose();
  • 11. Are .NET Events Obsolete? • .NET Events • Code centric • Design-time experience • Not first class • Non-compositional • Lightweight • Rigid execution model (IL) • Observables • Data centric • No design-time experience • First class objects • Rich composition • Slightly more cost • Translatable with expression trees
  • 12. The Event Processing Landscape Social media RSS feeds GPS Server management
  • 14. Event Streams • Towards a unified programming model • Producers are observable sequences • .NET events, WinRT events, sensor APIs, APM methods, tasks, etc. • Consumers are observers • Hooking up “continuations” or handlers Observable Subscribe Observer
  • 15. Essential Interfaces namespace System { public interface IObservable<out T> { IDisposable Subscribe(IObserver<T> observer); } public interface IObserver<in T> { void OnNext(T value); void OnError(Exception error); void OnCompleted(); } }
  • 16. Observable Sources • Single items / empty Observable.Return() • Lists and arrays • UI Events • Async methods • Subjects (demo) • Property Changes
  • 17. Cold / Hot • Hot : example MouseMove • Cold: when you subscribe, something happens (it waits)
  • 18. UI Example, Windows 8 Universal App
  • 19. This Presentation’s Reference Presentations • Bart De Smet “Curing Your Event Processing Blues with Reactive Extensions (Rx)” TechEd Europe 2012 http://channel9.msdn.com/events/TechEd/Europe/2012/DEV413 • Paul Betts “Introduction to Reactive Extensions” Norwegian Developer’s Conference 2012 http://vimeo.com/43659034 • Brendan Forster “Reactive UI – Turning MVVM up to 11” http://vimeo.com/97329155
  • 20. Further References, Links • https://rx.codeplex.com/ and https://github.com/Reactive- Extensions/Rx.NET as the starting point • RxJS (and other languages such as Ruby, C++, Python, Java, ObjC) https://github.com/Reactive-Extensions/RxJS • http://www.introtorx.com/ • 101 Rx Examples http://rxwiki.wikidot.com/101samples • http://amzn.to/programming-rx “Programming Reactive Extensions and LINQ”
  • 21. Further Research, Future • “Scalable Information Stream Processing by Bing in Support of Cortana Scenarios” http://channel9.msdn.com/posts/Scalable- Information-Stream-Processing-by-Bing-in-Support-of-Cortana- Scenarios • Actor model, “Microsoft Research project Orleans simplify development of scalable cloud services” http://channel9.msdn.com/Shows/Cloud+Cover/Episode-142- Microsoft-Research-project-Orleans-simplify-development-of- scalable-cloud-services

Notes de l'éditeur

  1. We no longer write sync software LINQ: the core of LINQ clojure/Haskell is a sequence (Ienumerable)  things in a particular order MoveNext() MoveNext() Yield/return LINQ : from sequence, and create a pipeline .Select .Where .ForEach (except last, deferred computation)
  2. An order LINQ describe what we are going to do with the data when get it it … without having the data THIS IS A MONAD Monad : chain together functions that describe what you want to do with the data
  3. In the C# world, events are not composable Events are first class elements of the language OnMouseUp + OnMouseDown != OnDoubleClick (delegates) Timer, hook onmouseup/onmousedown, Booleans, state … erg Events fight with different states Event is some stuff in a particular order (time  ) List; happened Events; future or going to happen
  4. Taking what you know about LINQ, applying to events IEnumerable : lists IObservable, stream of events Idisposable, can stop the subscription early. (only if doing early, unless complete on its own) GC will cleanup Iobservable == list, LINQ works .Subscribe is the foreach. Nothing happens until you .Subscribe
  5. .NET event to an observable Special one: Subject<T> push around by hand INotifyPropertyChanged == events