Reactive Extensions, Rx

2,171 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
2,171
On SlideShare
0
From Embeds
0
Number of Embeds
87
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • давайте вспомним buzzwords: Azure, Silverlight, Windows Phone
  • Speaker tips:The essential difference is who controls how the data is received.Philosophically this is nothing but how the application and the environment work together.Looking from the application’s point of view:Does it ask the environment – interactively – for data?  enumerableDoes it passively wait for the environment to send data and react to it?  observableBoth are complementary models. One doesn’t (aim to) replace the other.Matter of which one aligns more closely to which model:SQL’ s TDS protocol is pull-based, hence IE<T> is the best fit.Stock broker services may be push-based, hence IO<T> is a better match.Will see how one can convert between those.
  • Reactive Extensions, Rx

    1. 1. Reactive Extensions“democratize cloud”Dima Pasko
    2. 2. about me Kharkiv – Ciklum (Scale Point) - .NET – podcasts – open source
    3. 3. Erik Meijer Professor at Utrecht University One of the designers of Haskell Microsoft Architect LINQ Volta Rx
    4. 4. Rx mission “Rx is a library for composing asynchronous and event-based programs using observable collections.”
    5. 5. Rx current version • Base interfaces in BCL .NET 4 and WP7 • Stable version: v1.0.10621 Experimental Release: v1.1.11011 Last update: October 12, 2011 • http://msdn.microsoft.com/en- us/data/gg577609
    6. 6. Rx for .NET  .NET 3.5 SP1  .NET 4  .NET Framework 4.5 (with Metro support on Windows 8 Developer Preview) Silverlight  Silverlight 4  Silverlight 5  Windows Phone Java script
    7. 7. “asynchronous”
    8. 8. “observable”interface IObservable outinterface IEnumerable out IDisposable Subscribe IObserver IEnumerator Getinterface IEnumerator out IDisposableinterface IObserver in bool Move void On get void On Exception void void On
    9. 9. Application MoveNext Got next?Interactive Reactive OnNext Have next! IEnumerable<T> IObservable<T> IEnumerator<T> IObserver<T> Environment
    10. 10. IDisposableinterface IObservable out IDisposable Subscribe IObserverinterface IObserver in void On void On Exception void On
    11. 11. demo #1Simple example
    12. 12. exception handling Observable.Catch() Observable.Throw() Observable.Retry() Observable.Timeout()
    13. 13. demo #2Exception handling
    14. 14. “composing” • Linq(Where, Take, Skip, Sum, Max, Any, …) • Statements(If, Case, For, While, DoWhile) • Combinators(Merge, Zip, Amb, …) • Exceptions(Catch, Retry, ..) • Rx(Delay, Throttle, Interval, Publish, …)
    15. 15. “event-based” Observable.FromEventPattern() Observable.FromAsyncEventPattern()
    16. 16. IScheduler Observable.OnserveOn() Observable.SubscribeOn(Scheduler.TaskPool)
    17. 17. demo #3Big demo!!!
    18. 18. Rx unit testing
    19. 19. more RxRx Contrib http://rxcontrib.codeplex.com/Reactive Extensions - Extensions (Rxx) http://rxx.codeplex.com/Rx Power Toys http://rxpowertoys.codeplex.com/
    20. 20. examples
    21. 21. ReactiveUI http://www.reactiveui.net/
    22. 22. “Anna” http://github.com/jfromaniello/Anna
    23. 23. domain events http://chaliy.name/archive/2010/1/business_logic_rx_example
    24. 24. TweetSharp.Rx https://github.com/jhollingworth/TweetSharp.Rx
    25. 25. Rx in books Programming Reactive Extensions and LINQ Jesse Liberty, Paul Betts http://www.amazon.com/Programming-Reactive-Extensions-Jesse-Liberty/dp/1430237473/
    26. 26. out of scope • Hot&Cold • Marble diagrams • IQbservable<T> (IQueryable<T> + IObservable<T>) • ISubject, Subject<T> • ReactiveJS • ….
    27. 27. information Rx team blog http://blogs.msdn.com/rxteam DevLabs http://msdn.microsoft.com/en-us/data/gg577609 MSDN forums http://social.msdn.microsoft.com/Forums/en-US/rx Channel9 http://channel9.msdn.com/Tags/Rx Wiki http://rxwiki.wikidot.com Examples http://rxworkshop.codeplex.com/
    28. 28. summary
    29. 29. questions dimapasko@gmail.com pad@ciklum.net 31337 @dimapasko

    ×