Coder Perfect

[closed] A good introduction to the.NET Reactive Framework

Problem

Is there a suitable introduction and tutorial to the Microsoft Reactive (Rx) framework, aside from the Microsoft documentation?

Also, what is a good example (with code) of a programming problem that is difficult to handle with traditional asynchronous coding techniques that is made easier by Reactive?

Asked by LBushkin

Solution #1

UPDATE: My online book www.IntroToRx.com has taken the place of the blog postings below. It’s a 19-chapter book that’s offered for free. You may either read it online or get the mobi version for your kindle. For a small price (99c / 77p), you may also get it directly from Amazon. Let me (the Author) know if the book does not match your needs or expectations, and we will improve for v2.

Thank you for including a link to the Hot/Cold post in your comment. This is merely a portion of the entire series.

More Rx introductory material will be added to this blog in the future.

You should go to the Rx Forum for more advanced information (MSDN).

Answered by Lee Campbell

Solution #2

Here’s a wiki page with dozens of code examples explaining how to use the.NET Rx framework’s various features: http://rxwiki.wikidot.com/101samples

This is the most extensive site I’ve seen, and it’s also the easiest to begin started with.

Answered by LBushkin

Solution #3

Rx-Framework Rx-Framework Rx-Framework Rx-Framework R

The Source Code is useful for a developer who wants to dig deeper.

Rx keynote by a cool Austrian

This is the finest example I’ve seen so far: Rx: Curing your asynchronous programming blues – DevCamp 2010 Keynote

Channel 9 has some interesting videos.

Inside.NET Rx with IObservable/IObserver in the BCL, by Kim Hamilton and Wes Dyer (VS 2010)

Expert to Expert: Brian Beckman and Erik Meijer – Inside the.NET Reactive Framework is an interview with the creators of Rx: Expert to Expert: Brian Beckman and Erik Meijer – Inside the.NET Reactive Framework (Rx)

Rx’s creator gives an introduction.

An Codeproject Article

Another course’s first blog, this time with hyperlinks (new)

Answered by Summer-Time

Solution #4

It draws lines when the mouse button is pressed, which is simple to perform using reactive programming but difficult (if not impossible) with traditional events. It’s understandable, and there’s no explicit state management:

var pen = new Pen(Color.Red, 3);
var graphics = this.CreateGraphics();

var mouseMoveWhileDown = 
    from md in this.GetMouseDown()
    from mv in this.GetMouseMove().Until(this.GetMouseUp())
    select new Point(mv.X, mv.Y);

mouseMoveWhileDown
    .Pairwise()
    .Subscribe(tup => graphics.DrawLine(pen, tup.Item1, tup.Item2)); 

(I must admit, Pairwise() is a home-grown function in that example…)

The most significant feature of IObservable is that it, like IEnumerable, is ‘composable.’

I strongly suggest watching the video given in another answer. In reality, Channel9 has a number of videos on the issue, including:

Answered by Benjol

Solution #5

After you’ve gone over some of the basics, such as the HandsOnLab, be sure to check out Lee Campbell’s Hot and Cold Observables, which helped me decipher some of the esoteric mysteries of Rx:)

Answered by sweetlilmre

Post is based on https://stackoverflow.com/questions/1596158/good-introduction-to-the-net-reactive-framework