2. Who am I?
• C# Developer
• 6 years working with C#
• 2 years using Rx
• joao.lvidal@gmail.com
• http://ca.linkedin.com/pub/john-vidal/73/33b/812/
• http://stackoverflow.com/users/1128106/j-lennon
3. Aim of this talk
• Reactive Extensions
• Reactive Programming
• Reactive Technology
• Reactive Scenarios
4. What’s Reactive Extensions
• Library
Used to:
• Real-time data
• Push notifications
• Asynchronous requests
• Event processing
Main goals:
• Unique interface
• Compose operations
• Good code
5. History of Rx
• Created by Microsoft in 2009
• Initially called LINQ To Events
• Turned into an Open Source Project 2 years ago
7. Reactive - What’s the Point?
• By Microsoft:
Reactive Extensions is for composing asynchronous and event-based
programs using observable sequences and LINQ-style query operators.
• By Wikipedia:
Reactive Programming is a programming paradigm oriented around
data flows and the propagation of change.
• By Reactive Manifesto:
Reactive Systems are Responsive, Elastic, Resilient, Message Driven.
9. Specific Scenarios
• Real-time data
• TCP/IP directly (duplex communication)
• Real-time web technologies (e.g. Polling, Server Side Events, WebSocket)
• Serial data (e.g. USB/RS 232)
*In .NET: WCF using duplex binding or SignalR.
• Push notifications
• Mobile devices (e.g. IOS/Android/WP)
• Web browser extensions (e.g. Chrome/Firefox)
• Windows 8 apps
10. Common Scenarios
• Propagation of Change
• If you need tell somebody that something happens. For example:
- Any kind of event-based, asynchronous-based, subscription-based, notification-based
mechanism.
- Especially in combination or composition of more than one them
11. Common Apps
• Chat
• Stock Ticker
• Social Media
• Monitoring
• Games
• Dashboard
• Manufacturing
• Industrial Systems
• Event-driven Marketing
• Internet of Things
• Gestures (Kinect, Leap Motion)
12. References / To know more
Links:
• http://channel9.msdn.com/Tags/reactive+extensions
• http://www.introtorx.com/
• http://xgrommx.github.io/rx-book/
• http://reactconf.com/
• http://www.reactivemanifesto.org/
• http://www.infoq.com/reactive-extensions/
• http://blogs.msdn.com/b/rxteam/
People:
• Bart de Smet (Microsoft)
• Erik Meijer (Microsoft)
• Lee Campbell (IntroToRx)
• Jafar Hussain (Netflix)
• Jonathan Worthington
• James World
• Jim Wooley
• Dave Sexton
• Phil Haack
16. Bridges with Rx
• Event-based operations
• Any kind of Binding (e.g. using patterns such as: MVVM, MVVMC, MVPVM)
*In .NET: event keyword (e.g. EventHandler delegate such as PropertyChangedEventHandler for INotifyPropertyChanged)
• Async-based operations
• Callback / Promise / Future / Task
*In .NET: APM (IAsyncResult), EAP (EventNameCompleted += Handler), TAP (Task.Run(DoSomething)).
• Time-based operations
• Scheduling / Timeout
Especially in combination or composition of one or more scenarios.
17. Who are using Reactive Extensions?
• 300.000+ downloads on Nuget.org (.NET Version)
• Netflix
• Microsoft Bing/Cortana/Azure
• GitHub Windows Client
• Hundreds of repositories in GitHub
• Dozens supporting http://reactivemanifesto.org with ribbons
18. The Major Interfaces
public interface IObservable<out T>
{
IDisposable Subscribe(IObserver<T> observer);
}
public interface IObserver<in T>
{
void OnCompleted(); // Notifies the observer that the source has finished sending messages.
void OnError(Exception error); // Notifies the observer about any exception or error.
void OnNext(T value); // Pushes the next data value from the source to the observer.
}
19. Reasons to use Rx
1. Avoid callback hell
2. Common interface to use in the code
3. Taming side-effects