creating a simple doodle (drawing) like application using silverlight and reactive framework (rx)
DESCRIPTION
A presentation on building a simple doodle application using the Reactive Extensions framework in Silverlight.TRANSCRIPT
Creating a simple Doodle (drawing) like application using Silverlight
and Reactive Framework (RX)
Matt Duffield, MVP, MCSD .NEThttp://mattduffield.wordpress.com
@mattduffield
What is the Reactive Framework? IEnumerator IObserver IObserver modes Rx keywords Demo code
What we are going to cover
Rx is a library for composing asynchronous and event-based programs using observable collections.
Where can I use Rx? .NET Framework 3.5 SP1, 4 Silverlight 3, 4, 5 Windows Phone 7 XNA 4.0 for Xbox 360 Zune JavaScript
What is the Reactive Framework?
Asynchronous and event-based – as reflected in the title, the bread and butter of Rx’s mission statement is to simplify those programming models.
Composition – combining asynchronous computations today is way too hard. It involves a lot of plumbing code that has little to nothing to do with the problem being solved.
Observable collections – by looking at asynchronous computations as data sources, we can leverage the active knowledge of LINQ’s programming model.
Three core properties
Stock tickers RSS feeds Social media UI events GPS Server management
Why does it help?
public interface IEnumerator{
object Current { get; }bool MoveNext();void Reset();
}
Because we are waiting/”pulling” for a return value, these are blocking.
IEnumerator
public interface IObserver<T>{
void OnNext(T value);void OnError(Exception ex);void OnCompleted();
}
We get “pushed” when a new value is available.
IObserver
Hot – typically values that come in from events or a web service
Cold – known list of values from a collection, array, etc.
IObserver modes
FromEventPattern<T,U> Merge SkipUntil TakeUntil Throttle ObserveOn(Schedular.ThreadPool) Do TimeInterval – allow us to test for something
over time Subject<> FromAsnyncPattern<T,U>
Rx Keywords
Demo
Reactive Extensionshttp://msdn.microsoft.com/en-us/data/gg577609Erik Meijer and Wes Dyer Reactive Framework (RX) Under the
Hood 1 of 2http://channel9.msdn.com/Shows/Going+Deep/E2E-Erik-Meijer-and-Wes-Dyer-Reactive-Framework-Rx-Under-the-Hood-1-of-2Erik Meijer and Wes Dyer Reactive Framework (RX) Under the
Hood 2 of 2http://
channel9.msdn.com/Shows/Going+Deep/E2E-Erik-Meijer-and-Wes-Dyer-Reactive-Framework-Rx-Under-the-Hood-2-of-2
Bart de Smethttp://channel9.msdn.com/Blogs/joshholmes/Bart-de-Smet-in-Dublin-on-the-Rx-FrameworkJim Wooley – ThinqLinqhttp://www.thinqlinq.com/http://live.visitmix.com/MIX11/Sessions/Speaker/Jim-Wooley
References
Questions?
Matt Duffield, MVP, MCSD .NEThttp://mattduffield.wordpress.com
@mattduffield