18
ENHANCING USER EXPERIENCES WITH REACTIVE EXTENSIONS Bryan Anderson

Enhancing user experiences with reactive extensions tccc10

Embed Size (px)

Citation preview

Page 1: Enhancing user experiences with reactive extensions   tccc10

ENHANCING USER EXPERIENCES WITH REACTIVE EXTENSIONS

Bryan Anderson

Page 2: Enhancing user experiences with reactive extensions   tccc10

What is Rx?

Reactive Extensions are a set of extension methods that allow you

to compose and operate on streams with LINQ operators in the same way you would a list.

Page 3: Enhancing user experiences with reactive extensions   tccc10

Compose and operate on streams? Sounds like it’s time

for me to take a nap.

Page 4: Enhancing user experiences with reactive extensions   tccc10

Streams?

A stream can be thought of as a list of events that take place over

time.

Page 5: Enhancing user experiences with reactive extensions   tccc10

Compose?

Sticking functions together, like Legos. Say we have two functions

f and g.Math: f(g(x))Unix: x | g | f

Page 6: Enhancing user experiences with reactive extensions   tccc10

What is Rx?

Reactive Extensions are a set of extension methods that allow you

to compose and operate on streams with LINQ operators in the same way you would a list.

Page 7: Enhancing user experiences with reactive extensions   tccc10

It’s too early to think abstractly and a nap sounds

really good right now.

Page 8: Enhancing user experiences with reactive extensions   tccc10

IObservable vs IEnumerable

IObservable and IEnumerable are mathematical duals. Which just means they’re equivalent. Every IEnumerable could be turned into

an IObservable and vice-versa (with enough time).

Page 9: Enhancing user experiences with reactive extensions   tccc10

If they’re equivalent what does IObservable give us?

Page 10: Enhancing user experiences with reactive extensions   tccc10

IObservable vs IEnumerable

IEnumerable let’s you pull items from it.

IObservable pushes items to you.

Page 11: Enhancing user experiences with reactive extensions   tccc10

IObservable vs IEnumerable

When it comes down to it

IObservable = IEnumerable + Time

Page 12: Enhancing user experiences with reactive extensions   tccc10

Marble Diagrams

Running observable:Completed normally:Completed with an exception:

Input goes above output:

Page 13: Enhancing user experiences with reactive extensions   tccc10

I think you’ve lost your marbles.

Page 14: Enhancing user experiences with reactive extensions   tccc10

Questions so far?

Please feel free to ask questions as we go.

Page 15: Enhancing user experiences with reactive extensions   tccc10

The LINQ you’re used to

Common LINQ queries work the same Select Where First Skip Take

Page 16: Enhancing user experiences with reactive extensions   tccc10

Time adds more options

Throttle Delay BufferWithTime, BufferWithCount Scan Zip, Merge, CombineLatest

Page 17: Enhancing user experiences with reactive extensions   tccc10

Dude, this is a CODE camp. You need to stop talking and

show me some code!

Page 18: Enhancing user experiences with reactive extensions   tccc10

Questions?

I love feedback!

Bryan [email protected]

@SolaAesir