Rx Framework Reactive Extensions for.Net and JavaScript Andrea Nasoni & Diego Guidi.

Slides:



Advertisements
Similar presentations
Reactive Extension to .NET
Advertisements

Slides license: Creative Commons Attribution Non-Commercial Share Alike See
Achieving with Rx Sean Seanmccarthy.me.
Het Asynchrone Microsoft Landschap Kees Dijk Senior Software Developer, Vivens
An Introduction to the Reactive Extensions Ivan Towlson Mindscape.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 12 th -13 th Lecture Pavel Ježek.
Bing it on, Reactive Extensions Building a quick search app from scratch in WPF with Rx and Bing.com.
How to be a C# ninja in 10 easy steps. Benjamin Day.
Demystifying the .NET Asynchronous Programming Landscape
ASP.NET 3.5 Mike Ormond Developer & Platform Group Microsoft Ltd
Object-Oriented Programming with Java The Java Event Model Lecture 5.
CS 280 Data Structures Professor John Peterson. Quiz 4 Recap Consider the following array: {2, 6, 7, 3, 4, 1, 5, 9}. Draw this in tree form and then show.
.NET Framework V3.5+ & RESTful web services Mike Taulty Developer & Platform Group Microsoft Ltd
WCF RIA Services - Querying and Updating Data SILVERLIGHTSHOW.NET WEBINARS SERIES BRIAN NOYES, CHIEF ARCHITECT, IDESIGN INC 2 FEB 2011.
Reactive Programming with F# Tomáš Petříček Microsoft C# MVP
An introduction to F# (part 2) Bogdan Brinzarea-Iamandi Banca Romaneasca 25 February 2010.
Microsoft ASP.NET AJAX - AJAX as it has to be Presented by : Rana Vijayasimha Nalla CSCE Grad Student.
What’s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd
Iterator Pattern Dr. Neal CIS 480. Iterator An iterator pattern can be used when one class is a collection of things and would like to provide a standardized.
Object-Oriented Programming with Java Lecture 2 The Java Event Model.
Object-Oriented Analysis and Design
Curing Your Event Processing Blues with Reactive Extensions (Rx)
A tour of new features introducing LINQ. Agenda of LINQ Presentation We have features for every step of the way LINQ Fundamentals Anonymous Functions/Lambda.
Parallel Programming in.NET Kevin Luty.  History of Parallelism  Benefits of Parallel Programming and Designs  What to Consider  Defining Types of.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
LINQ Programming in C# LINQ CSE Prof. Roger Crawfis.
Developing Mobile Applications using MVVM with Xamarin Forms
Webinar presented by Erick Polsky 10/2/2012. What is.Net? Combines… Language Independence Memory Management Database Access Class Libraries Operating.
LINQ, Take Two Realizing the LINQ to Everything Dream Bart J.F. De Smet Senior Software Development Engineer Microsoft Corporation.
Welcome to CIS 083 ! Events CIS 068.
Delegates and lambda functions Jim Warren, COMPSCI 280 S Enterprise Software Development.
Reactive Extensions Ye olde introduction and walk-through, with plenty o’ code.
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
A Revolutionary Programming Pattern that Will Clean up your Code : Coroutines in C++ David Sackstein ACCU 2015.
CIS 3301 C# Lesson 13 Interfaces. CIS 3302 Objectives Understand the Purpose of Interfaces. Define an Interface. Use an Interface. Implement Interface.
Monads Steve Goguen. About Me Web Developer for Allied Building Supply  ASP.NET, SQL Server, LINQ, etc. Website:
Introduction to LINQ Lecture # 19 August Introduction How do you interrogate/manipulate data? What if you could do the work in a type-safe," string-free.
Reactive Extensions (Rx) Explained Presenter: Kevin Grossnicklaus August 5 th, 2011.
LINQ, Take Two Realizing the LINQ to Everything Dream Bart J.F. De Smet blogs.bartdesmet.net/bart
How to be a C# ninja in 10 easy steps Benjamin Day.
Paul Using Rx; 8 November 2014 Raleigh Code Camp.
Developing AJAX Web applications with Castle Monorail David De Florinier Gojko Adzic Skills Matter 12/06/08.
1 Lecture 21 Reactive Programming with Rx Duality between Push and Pull models, Iterable vs. Observable. Composing two asynchronous services. Ras Bodik.
Please visit m.ausalgo.com on your device and sign inm.ausalgo.com.
Last Lecture objective C memory management rules Wrote our first iPhone app a quiz app xib and nib files and interface editor MVC pattern IBOutlet IBAction.
C# 2.0 and Future Directions Anders Hejlsberg Technical Fellow Microsoft Corporation.
1 Lecture 22 Reactive Programming with Rx Duality between Push and Pull models, Iterable vs. Observable. Composing two asynchronous services. Ras Bodik.
Module 8 Enhancing User Interface Responsiveness.
Parallel Pattern Library Resource Manager Task Scheduler Task Parallel Library Task Parallel Library Parallel LINQ Managed Native Key: Threads Operating.
Stephen Forte DAT401 from s in dat.Speaker select s.Bio; Chief Strategy Officer of Telerik Certified Scrum Master Active in the community: International.
Inside LINQ to Objects How LINQ to Objects work Inside LINQ1.
Developing with WCF RIA Services Quickly and Effectively Nikhil Kothari Software Architect, Microsoft Corporation Blog:
TAP into async programming
IAP C# 2011 Lecture 2: Delegates, Lambdas, LINQ Geza Kovacs.
Mouse Events GUI. Types of Events  Below, are some of the many kinds of events, swing components generate. Act causing EventListener Type User clicks.
User Interface Programming in C#: Basics and Events Chris North CS 3724: HCI.
Language Integrated Query Mike Taulty Developer & Platform Group Microsoft Ltd
Design Patterns: Behavioral Design Patterns General and reusable solutions to common problems in software design Software University
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Chapter  Array-like data structures  ArrayList  Queue  Stack  Hashtable  SortedList  Offer programming convenience for specific access.
Module 5: Programming with C#. Overview Using Arrays Using Collections Using Interfaces Using Exception Handling Using Delegates and Events.
RxJava and SWT: Out with Events, in with FRP
Lesson 1: Buttons and Events – 12/18
Advanced Topics in Concurrency and Reactive Programming: ReactiveX
Present by Andie Saizan, MCP
Build /2/2019 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
DEV422 Becoming a C# Time Lord Joe Albahari 2/5/ :46 AM
Server & Tools Business
GoTo IEnumerable considered harmful
.NET Framework V3.5+ & RESTful web services
Presentation transcript:

Rx Framework Reactive Extensions for.Net and JavaScript Andrea Nasoni & Diego Guidi

What is Rx? "Rx is a library for composing asynchronous and event-based programs using observable collections." (cit.) Asynchronous and event-based o No more 'Dispatcher.Invoke' calls o subscribe/unsubscribe made easy Composition o filters/projections o combining events When.OnMouseDown.Then.OnMouseMove.DoWork.Until.OnMouseUp Observable collections o your mouse as a database

IObservable to the rescue IObservable : a data source that can be observed public interface IObservable IDisposable Subscribe(IObserver observer); IObserver : an object that observes public interface IObserver void OnNext(T value); void OnCompleted(); void OnError(Exception error);

Push vs Pull IEnumerable : a data source that can be iterated public interface IEnumerable IEnumerator GetEnumerator(); IEnumerator : an object that iterates public interface IEnumerator : IDisposable bool MoveNext(); T Current { get; } void Reset(); Duality : data source pushes data at its observers enumerable data sources are being pulled by an enumerator IObservable : powered by Linq!

Async programming is Hard Many kinds of sources, many ways to handle them o Timers o Events o Calling services o Custom invokes o Dispatcher.Invoke... BeginCall...EndCall...IAsyncResult? Error management? Cancelation?

Push sources (1) actually... Events are a push source for EventArgs objects Timers are a push source for time passing Asynchronous Services are a push source for your result...

Push sources (2) Every async operation callback can be a push "data" source! IEnumerable (and IQueryable ) o is a data source o can be queried, projected, filtered with Linq Here comes IObservable (and IQbservable ) o interface in.Net Framework 4.0 We can use Linq to query our timebased datasource Here comes rx framework

IEnumerable vs. IObservable Pull: IEnumerable (inline code) foreach (T value in...) foreach loop ends try/catch exception handling Push: IObservable (IObserver ) OnNext(T value) OnCompleted() OnError(Exception ex)

Rx in.Net Framework 3.5, 4.0, Silverlight, Windows Phone, Xna... Assemblies: o System.CoreEx  (Scheduler, Disposable, Event,...)  General purpose classes o System.Reactive  rx framework extension methods and helper methods  depends on System.CoreEx, IObservable implementation o (System.Interactive)  IEnumerable extensions o (System.Reactive.Testing)  For testing purposes

Rx in.Net Async/Push based notification, starting from: o Events Observable.FromEvent(obj, "EventName") o AsyncPattern Observable.FromAsyncPattern(BeginMethod, EndMethod) o Functions var async = func.ToAsync(); async(param1).Subscribe(...) o Custom implementation  Implementing IObservable interface  using ISubject

Features Linq based approach Projections Filtering Composition Dispose-based un-registration Error management

Observable sources From Events o IObservable > From Async Pattern o Web/WCF service async invoke Helper methods o Observable.{Method}(...) o es. Observable.Interval(TimeSpan.FromSeconds(1))

Observable Manipulation Filtering o observable.Where(x => x < 10) Projection o observable.Select(x => x.GetPosition(this)) Observable Composition o Starting from my left mouse button down and until I don't release it, draw a polyline with a point every 20 milliseconds o TakeWhile, SkipUntil...

Examples Observable.Interval Observable.ToAsync (Async function call) Observable.FromAsyncPattern (Wcf async call) OnError/OnCompleted Polling a value/Dispose subscription Observable.FromEvent ObserveOnDispatcher Wpf Drag & Drop Wpf Polyline? CancellationToken

More on Rx Framework Hot and cold observables Side-effects Publish/Connect/RefCount Run/Do ISubject and its implementations Schedulers Disposables implementations Observable.Create/CreateWithDisposable Generated code for Extension methods for rx events

Rx extensions for JavaScript code, code, code...

Finally... Rx Hands-On Labs: published.aspx Rx Wiki: Matthew Podwysocki's blog:

Thats all ;) Rx rocks!