Bing it on, Reactive Extensions Building a quick search app from scratch in WPF with Rx and...

14
Bing it on, Reactive Extensions Building a quick search app from scratch in WPF with Rx and Bing.com

Transcript of Bing it on, Reactive Extensions Building a quick search app from scratch in WPF with Rx and...

Bing it on, Reactive Extensions

Building a quick search app from scratch in WPF with Rx and Bing.com

What is Rx?!

• Library – mainly consisting of extension methods

• Developed by Microsoft• Aims to simplify event handling and async

operations• LINQ-friendly

Requirements

• .NET 3.5SP1 (4 or newer preferred)• Windows Phone 7 (7.1 or newer preferred)• Silverlight 4 (5 or newer preferred)• Also available for JavaScript

Why should I use it?

• Simplifies async queries (and other operations)

• Makes async and event handling code (much) easier to unit-test

• Less code – simpler maintenance• Less bugs

How do I get it?

• Download from MSDN• Install with NuGet Package Manager• Install via Visual Studio Extension SDK

Basics

• IObservable<T>, IObserver<T>• Similar to IEnumerable<T> and

IEnumerator<T>• Main difference : Data in motion vs Data in

memory

IObservable<out T>

• IDisposable Subscribe(IObserver<T> observer);

IObserver<T>

• void OnNext(T value);• void OnError(Exception error);• void OnCompleted();

Key features

• Compose two or more observables– Pipeline them– Join them– …

• Use one of the many pre-built modifiers• Build your own modifiers

Demo

Questions?

References

• http://www.introtorx.com/• http://rxwiki.wikidot.com/101samples

Contact

Andrei RineaWorking at IBM as a Senior Software Developer

• B : http://blog.andrei.rinea.ro • L : http://www.linkedin.com/in/andreirinea • T : https://twitter.com/AndreiR23• F : https://www.facebook.com/andrei.rinea

In the memory of my mother, Rodica.