Your SlideShare is downloading. ×
Rx for .net
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Rx for .net

1,060
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,060
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Some notes
  • Some notes
  • Some notes
  • Some notes
  • After this slide should be an example of working code using VS 2010
  • Some notes
  • Transcript

    • 1. Reactive Extensions for .NET, Rx
      One of the most powerful extensions for .NET Framework
      IevgenOlieniev
      .Net Senior Developer
      Soft Serve
    • 2. The first appearance in the world:
      July 2009
      Unit Tests
    • 3. Current situation:
      Includes libraries:
      • System.CoreEx.dll
      • 4. System.Interactive.dll
      • 5. System.Observable.dll
      • 6. System.Reactive.dll
      • 7. System.Reactive.Testing.dll
    • The iteratorpatern
    • 8. Pulling data from a source
      int[] numbers=newint[] { 20, 31, 5, 16, 22};
      IEnumerable<int>numbersSmallerThan20=numbers.Where(number=>number<20);
      5, 16, break
      IEnumerable<int>NaturalNumbers()
      {
      intnumber=0;
      while(true)
      {
      yieldreturnnumber;
      number++;
      }
      }
      0,1,2,3,4,5,6…
    • 9. Reactive programming
      button.MouseMove+= (s, args) =>
      Debug.WriteLine("You moved the mouse to {0}",
      args.GetPosition(button));
      “You moved the mouse to 20,3”
      “You moved the mouse to 33,12”
      “You moved the mouse to 44,18”
      DownloadFile("http://www.jeffwilcox.com", (byteArray) =>
      Debug.WriteLine("This file is {0} bytes long.",
      byteArray.Length);
      “This file is 12323 bytes long.”
    • 10. Events and Callbacks are
      Sequences of Data!
      newMouseEventArgs(newPoint(20,3)),
      newMouseEventArgs(newPoint(33,12)),
      newMouseEventArgs(newPoint(44,18))…
      newbyte[]{23,211,33,23…}, break
    • 11. A new look atthe observer pattern
    • 12. Unit testing slui with rx
      Rating rating = new Rating();
      IObservable<Unit> test =
      ObservableExtensions      .DoAsync(() => TestPanel.Children.Add(rating)) // add a control to a panel      .WaitFor(TestPanel.GetLayoutUpdated()) // listen to LayoutUpdated event      .DoAsync(() => rating.Value = 1.0) // set a property      .WaitFor(          rating.GetActualValueChanged() // listen to ActualValueChanged event            .SkipWhile(actualValueChangedEvent =>               actualValueChangedEvent.EventArgs.NewValue != rating.Value))       .Assert(() => rating.GetRatingItems().Last().ActualValue == 1.0); // Assert// run the test and clean up at the endtest.Subscribe(() => TestPanel.Children.Remove(rating));
    • 13. Info References:
      • Introducing Rx (Linq to Events) - http://themechanicalbride.blogspot.com/2009/07/introducing-rx-linq-to-events.html
      • 14. A Brief Introduction to the Reactive Extensions for .NET, Rx - http://blogs.msdn.com/b/wesdyer/archive/2009/11/18/a-brief-introduction-to-the-reactive-extensions-for-net-rx.aspx
      • 15. First encounters with Reactive Extensions -http://msmvps.com/blogs/jon_skeet/archive/2010/01/16/first-encounters-with-reactive-extensions.aspx
      • 16. LINQ to Rx: second impressions - http://msmvps.com/blogs/jon_skeet/archive/2010/01/19/linq-to-rx-second-impressions.aspx
      • 17. DevLabs: Reactive Extensions for .NET (Rx) -http://rxwiki.wikidot.com/
    • download References:
      • Rx for Silverlight 4 - http://go.microsoft.com/fwlink/?LinkId=182998
      • 18. Rx for .NET Framework 4.0 - http://go.microsoft.com/fwlink/?LinkId=182997
      • 19. Rx for JavaScript -http://msdn.microsoft.com/devlabs/ff628422
      • 20. Rx for .NET Framework 3.5 SP1 -http://go.microsoft.com/fwlink/?LinkId=182996
    • Thank You!