Just another side of me

My name is Veri, MSP from ITB. Enjoy my blog...
See also: Other Geeks@INDC

Reactive Extensions (Rx)

Hello readers, we meet again. In this blog post, I will help you in understanding Reactive Extensions (Rx).

Reactive Extensions (Rx)

According to MSDN Library, Reactive Extensions is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators.

Rx represents many data sequences, such as stream of data, web services requests, system notifications, or a series of user input, as observable sequences. If subscribed by an application, this observable sequences can push data to the application asynchronously as new data arrive.

The Rx library is available for desktop application development using .NET, and also available for Silverlight, Windows Phone 7, and JavaScript. The differences between all of them can be read in here.

Interactive V.S Reactive Programming

At this point, maybe you’ll ask me, what is interactive programming? And what is reactive programming? What’re the differences between them and how do they related to Rx?

In interactive programming, the application will try to “pull” the data from the data source to get more information. In code, it is represented by the IEnumerable<T>/IEnumerator<T> interface. The IEnumerable<T> interface have a GetEnumerator() method to iterate through the collection while the IEnumerator<T> interface have the MoveNext method to advances the enumerator to the next element of the collection if there is any.

In reactive programming, the application don’t have to “pull” the data from the data source. Instead, the data source will “push” the data to the application if there are more data to offer. This is what they call with Rx. This action can be done by subscribing to the IObservable<T>/IObserver<T> interface. The IObservable<T> interface is similar to IEnumerable<T> interface. It abstracts a sequence of data, and keeps a list of IObsever<T> implementations that are interested in the data sequence.

For more tutorial about Rx, you can visit this link.

That’s all for this post. See you soon in my next post and ciao…

Share this post: | | | |

Comments

No Comments