code reactions - an introduction to reactive extensions
TRANSCRIPT
Code Reactions – An Introduction to Reactive Extensions
Jason BockPractice Lead
»http://www.magenic.com
»http://www.jasonbock.net
»https://www.twitter.com/jasonbock
»https://www.github.com/jasonbock
Personal Info
https://github.com/JasonBock/
CodeReactions
Downloads
»Why Rx?
»Using Rx
Overview
Remember…
https://github.com/JasonBock/
CodeReactions
Why Rx?
http://frmilovan.files.wordpress.com/2010/05/ford-assembly-line.jpg
Why Rx?
http://icons.iconarchive.com/icons/3xhumed/tools-hardware-pack-4/256/CPU-Z-icon.png
Why Rx?
MainWindow.xaml<Button
Click="OnStartListeningClick" />
MainWindow.xaml.csprivate void OnStartListeningClick(
object sender, RoutedEventArgs e){
// ...}
Why Rx?
http://www.lolroflmao.com/wp-content/uploads/2012/05/wrong-wrong-wrong.jpg
Why Rx?
http://www.redorbit.com/media/uploads/2013/03/ChemicalReactions_031513-617x416.jpg
http://icyroadsafety.com/parts/blackice1.jpg
http://www.venelogia.com/uploads/mandrake/2012-movie.jpg
Why Rx?
http://icons.iconarchive.com/icons/3xhumed/tools-hardware-pack-4/256/CPU-Z-icon.png
Why Rx?
http://techblog.netflix.com/2013/01/reactive-programming-at-netflix.html
http://savas.me/2014/04/reactive-computing-at-the-heart-of-cortana/
http://reactconf.com/
Why Rx?
Why Rx?
http://2.bp.blogspot.com/-6m8BQlS7-
g8/UArVdKi8yJI/AAAAAAAADFs/tcUDGbkm9Hg/s1600/ChemicalExplosion.jpg
Why Rx?
http://wondrouspics.com/wp-content/uploads/2012/04/bomb-explosion-nuclear-explosions-wallpaper-
540x337.jpg
Why Rx?
StocksDB
What is the current stockprice for MSFT?
37.96 (3/3/2014, 8:32:00 AM Central)
Why Rx?
StocksDB
What is the current stockprice for MSFT?
Why Rx?
StocksDB
37.97
37.98
Tell me when the stockprice changes for MSFT
Why Rx?
Comment feeds
Sensor data
Key logging
Navigation events
File watching
UI events
Game play
Why Rx?
http://www.reactivemanifesto.org/images/full-reactive.png
Why Rx?
http://rehansaeed.co.uk/reactive-extensions-part1-replacing-events/
Using Rx
.NET
Java
C++
Ruby
JavaScript
Python
https://github.com/Reactive-Extensions
Using Rx
Using Rx
http://blog.sudobits.com/wp-content/uploads/2011/08/keylogging-on-ubuntu.jpg
» In .NET 4.0
› IObserver<T>− OnCompleted()
− OnError(Exception e)
− OnNext(T value)
› IObservable<T>− Subscribe(IObservable<T> observer)
Using Rx
Demo: Observe Key PressesCode Reactions –An Introduction to Reactive Extensions
Using Rx
public class MyObservable: IObservable<char>
Observable.FromEventPattern(...)
Demo: Creating ObservablesCode Reactions –An Introduction to Reactive Extensions
Using Rx
the quick brown fox jumped over the lazy dog
ECBFEDEEADG.Where(…) .Take(…) 6.4 seconds
Demo: Modifying ObservablesCode Reactions –An Introduction to Reactive Extensions
Using Rx
the quick brown fox jumped over the lazy dog
OnError()
Retry()
Demo: Exceptions and ObservablesCode Reactions –An Introduction to Reactive Extensions
Using Rx
http://www.teetshirts.com/images/uploads/volume-to-11.jpg
Using Rx
REST API KeyloggerWeb API
Sig
nalR
Demo: Keylogger PipelineCode Reactions –An Introduction to Reactive Extensions
Using Rx
http://social.eli.ubc.ca/files/2011/08/fail.jpg
Using Rx
http://nimitdholakia.files.wordpress.com/2011/01/time.jpg
Demo: Unit Testing and RxCode Reactions –An Introduction to Reactive Extensions
Using Rx
http://www.dotnetfoundation.org/
Code Reactions – An Introduction to Reactive Extensions
Jason BockPractice Lead
Remember… https://github.com/JasonBock/CodeReactions http://www.slideshare.net/jasonbock/code-reactions-an-
introduction-to-reactive-extensions References in the notes on this slide