Creating a simple Doodle (drawing) like application using Silverlight and Reactive Framework (RX)<br />Matt Duffield, MVP,...
What is the Reactive Framework?<br />IEnumerator<br />IObserver<br />IObserver modes<br />Rx keywords<br />Demo code<br />...
Rx is a library for composing asynchronous and event-based programs using observable collections.<br />Where can I use Rx?...
Asynchronous and event-based – as reflected in the title, the bread and butter of Rx’s mission statement is to simplify th...
Stock tickers<br />RSS feeds<br />Social media<br />UI events<br />GPS<br />Server management<br />Why does it help?<br />
public interface IEnumerator<br />{<br />		object Current { get; }<br />boolMoveNext();<br />		void Reset();<br />}<br />B...
public interface IObserver<T><br />{<br />		void OnNext(T value);<br />		void OnError(Exception ex);<br />void OnCompleted...
Hot – typically values that come in from events or a web service<br />Cold – known list of values from a collection, array...
FromEventPattern<T,U><br />Merge<br />SkipUntil<br />TakeUntil<br />Throttle<br />ObserveOn(Schedular.ThreadPool)<br />Do<...
Demo<br />
Reactive Extensions<br />http://msdn.microsoft.com/en-us/data/gg577609<br />Erik Meijer and Wes Dyer Reactive Framework (R...
Upcoming SlideShare
Loading in …5
×

Creating a simple doodle (drawing) like application using silverlight and reactive framework (rx)

1,456 views

Published on

A presentation on building a simple doodle application using the Reactive Extensions framework in Silverlight.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,456
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  •  Asynchronous and event-based – As reflected in the title, the bread and butter of Rx’s mission statement is to simplify those programming models. Everyone knows what stuck user interfaces look like, both on the Windows platform and on the web. And with the cloud around the corner, asynchrony becomes quintessential. Low-level technologies like .NET events, the asynchronous pattern, tasks, AJAX, etc. are often too hard.  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. In particular, the data flow of the operations involved in the problem is not clear at all, and code gets spread out throughout event handlers, asynchronous callback procedures, and whatnot.  Observable collections – By looking at asynchronous computations as data sources, we can leverage the active knowledge of LINQ’s programming model. That’s right: your mouse is a database of mouse moves and clicks. In the world of Rx, such asynchronous data sources are composed using various combinators in the LINQ sense, allowing things like filters, projections, joins, time-based operations, etc.
  • Creating a simple doodle (drawing) like application using silverlight and reactive framework (rx)

    1. 1. Creating a simple Doodle (drawing) like application using Silverlight and Reactive Framework (RX)<br />Matt Duffield, MVP, MCSD .NET<br />http://mattduffield.wordpress.com<br />@mattduffield<br />
    2. 2. What is the Reactive Framework?<br />IEnumerator<br />IObserver<br />IObserver modes<br />Rx keywords<br />Demo code<br />What we are going to cover<br />
    3. 3. Rx is a library for composing asynchronous and event-based programs using observable collections.<br />Where can I use Rx?<br />.NET Framework 3.5 SP1, 4<br />Silverlight 3, 4, 5<br />Windows Phone 7<br />XNA 4.0 for Xbox 360<br />Zune<br />JavaScript<br />What is the Reactive Framework?<br />
    4. 4. Asynchronous and event-based – as reflected in the title, the bread and butter of Rx’s mission statement is to simplify those programming models.<br />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.<br />Observable collections – by looking at asynchronous computations as data sources, we can leverage the active knowledge of LINQ’s programming model.<br />Three core properties<br />
    5. 5.
    6. 6. Stock tickers<br />RSS feeds<br />Social media<br />UI events<br />GPS<br />Server management<br />Why does it help?<br />
    7. 7.
    8. 8.
    9. 9.
    10. 10.
    11. 11.
    12. 12.
    13. 13.
    14. 14.
    15. 15.
    16. 16. public interface IEnumerator<br />{<br /> object Current { get; }<br />boolMoveNext();<br /> void Reset();<br />}<br />Because we are waiting/”pulling” for a return value, these are blocking.<br />IEnumerator<br />
    17. 17. public interface IObserver<T><br />{<br /> void OnNext(T value);<br /> void OnError(Exception ex);<br />void OnCompleted();<br />}<br />We get “pushed” when a new value is available.<br />IObserver<br />
    18. 18. Hot – typically values that come in from events or a web service<br />Cold – known list of values from a collection, array, etc.<br />IObserver modes<br />
    19. 19. FromEventPattern<T,U><br />Merge<br />SkipUntil<br />TakeUntil<br />Throttle<br />ObserveOn(Schedular.ThreadPool)<br />Do<br />TimeInterval – allow us to test for something over time<br />Subject<><br />FromAsnyncPattern<T,U><br />Rx Keywords<br />
    20. 20. Demo<br />
    21. 21. Reactive Extensions<br />http://msdn.microsoft.com/en-us/data/gg577609<br />Erik Meijer and Wes Dyer Reactive Framework (RX) Under the Hood 1 of 2<br />http://channel9.msdn.com/Shows/Going+Deep/E2E-Erik-Meijer-and-Wes-Dyer-Reactive-Framework-Rx-Under-the-Hood-1-of-2<br />Erik Meijer and Wes Dyer Reactive Framework (RX) Under the Hood 2 of 2<br />http://channel9.msdn.com/Shows/Going+Deep/E2E-Erik-Meijer-and-Wes-Dyer-Reactive-Framework-Rx-Under-the-Hood-2-of-2<br />Bart de Smet<br />http://channel9.msdn.com/Blogs/joshholmes/Bart-de-Smet-in-Dublin-on-the-Rx-Framework<br />Jim Wooley – ThinqLinq<br />http://www.thinqlinq.com/<br />http://live.visitmix.com/MIX11/Sessions/Speaker/Jim-Wooley<br />References<br />
    22. 22. Questions?<br />Matt Duffield, MVP, MCSD .NET<br />http://mattduffield.wordpress.com<br />@mattduffield<br />

    ×