Reactive Extensions Ye olde introduction and walk-through, with plenty o’ code.

Slides:



Advertisements
Similar presentations
PCT303 – Content Publishing in SharePoint Eugene Rosenfeld Black Blade Associates
Advertisements

Attie Naude 14 May 2013 Windows Azure Mobile Services.
Reactive Extension to .NET
Slides license: Creative Commons Attribution Non-Commercial Share Alike See
Het Asynchrone Microsoft Landschap Kees Dijk Senior Software Developer, Vivens
An Introduction to the Reactive Extensions Ivan Towlson Mindscape.
JMS messaging service  All write-only Fedora operations are published to subscribed clients  Messaging system can be durable – if client/consumer/subscriber.
Bing it on, Reactive Extensions Building a quick search app from scratch in WPF with Rx and Bing.com.
Lessons learned from developing a Windows 8 Metro application in C# Frode Nilsen Nilsen Labs Ticki.
Computer Monitoring System for EE Faculty By Yaroslav Ross And Denis Zakrevsky Supervisor: Viktor Kulikov.
Rx Framework Reactive Extensions for.Net and JavaScript Andrea Nasoni & Diego Guidi.
Graphical User Interface (GUI) Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Microsoft ASP.NET AJAX - AJAX as it has to be Presented by : Rana Vijayasimha Nalla CSCE Grad Student.
CS533 Concepts of Operating Systems Class 2 The Duality of Threads and Events.
CS533 Concepts of Operating Systems Class 3 Integrated Task and Stack Management.
What’s new in ASP.NET 3.5? Mike Ormond Developer & Platform Group Microsoft Ltd
CREATIONAL DESIGN PATTERN Object Pool. CREATIONAL DESIGN PATTERN creational design patterns are design patterns that deal with object creation mechanisms,
Aptech Borivali(West) Hefin Dsouza. Agenda  What is.NET and What is Visual Studio? .NET Framework 3.5 Overview.  Visual Studio 2008 Enhancements. 
Students: Nadia Goshmir, Yulia Koretsky Supervisor: Shai Rozenrauch Industrial Project Advanced Tool for Automatic Testing Final Presentation.
Building Offline/Cache Mode Web Apps Using Sync Framework Mike Clark Group Manager Cloud Data Services Team
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Introduction to Silverlight. Slide 2 What is Silverlight? It’s part of a Microsoft Web platform called Rich Internet Applications (RIA) There is a service.
Todd Snyder Development Team Lead Infragistics Experience Design Group.
Computer Measurement Group, India Optimal Design Principles for better Performance of Next generation Systems Balachandar Gurusamy,
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Reactive Extensions (Rx) Explained Presenter: Kevin Grossnicklaus August 5 th, 2011.
CIS 451: ASP.NET Concepts Dr. Ralph D. Westfall January, 2009.
Paul Using Rx; 8 November 2014 Raleigh Code Camp.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Please visit m.ausalgo.com on your device and sign inm.ausalgo.com.
Server to Server Communication Redis as an enabler Orion Free
Model View Controller A Pattern that Many People Think They Understand, But Has A Couple Meanings.
1 Lecture 22 Reactive Programming with Rx Duality between Push and Pull models, Iterable vs. Observable. Composing two asynchronous services. Ras Bodik.
Ajax VS Flex A comparison based on shopping cart implementation PoHsu Yeh py2157.
Thinking reactive. Who is speaking? Software developer at Seavus Member of JugMK coffee - code - pizza - repeat.
Advanced Windows Store App Development with HTML5 Refresh / Exam Prep M6: Tools and Asynchronous Programming Jeremy Foster Microsoft Technical.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
CpE PROJECT: Concurrent Programming - Web Services Aim: To develop a multi threaded web service which handles requests from multiple clients, interact.
Procedural programming Procedural programming is where you specify the steps required. You do this by making the program in steps. Procedural programming.
ASP.net Course From Intermediate to Advance level By Arsalan Ahmed 3 Months Course Cell :
Best Web Technologies for
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.
Introducing the Microsoft® .NET Framework
DotNetSpider Editor Hefin Dsouza
Building Custom Workflows
Introduction to Redux Header Eric W. Greene Microsoft Virtual Academy
Advanced Topics in Concurrency and Reactive Programming: The Observable Contract Majeed Kassis.
Async or Parallel? No they aren’t the same thing!
Observer Design Pattern
Haritha Dasari Josue Balandrano Coronel -
Introduction to Silverlight
Introduction to the MVVM Pattern
Creating Windows Store Apps Using Visual Basic
Advanced Topics in Concurrency and Reactive Programming: ReactiveX
Present by Andie Saizan, MCP
Model-View-Controller Patterns and Frameworks
Patterns.
Nathan Totten Technical Evangelist Windows Azure
Building responsive apps and sites with HTML5 web workers
5 Leading web development Framework is good for developing a Secure Website.
DEV422 Becoming a C# Time Lord Joe Albahari 2/5/ :46 AM
Introduction to AppInventor
WCF Data Services and Silverlight
Server & Tools Business
Lecture Topics: 11/1 Hand back midterms
Matthew Farmer Making Azure Integration Services Real
Presentation transcript:

Reactive Extensions Ye olde introduction and walk-through, with plenty o’ code

OK, what is it? ● A library to compose asynchronous and event- based programs using observable collections and LINQ-style query operators. ● Keywords: Compose, LINQ, Asynchronous, Compose, LINQ, Asynchronous

Reactive what? ● Wikipedia: a programming paradigm oriented around data flows and the propagation of change ● Interactive: a = b + c Meaning: a will store the current values of b and c (added), but future updates to b and c will not affect a ● Reactive: Meaning: a will be updated when either b or c (or both) changes in the future

Reactive vs Interactive, part II (push vs pull) ● Interactive (pull, compare with polling) ● Reactive (push, compare with notifications) ● Key concept: create a query now, receive updates in the future.

The library ● Created by Microsoft ● Built on Parallel extensions library (PFX, meaning fully multi-threaded from day one) ● Open source as of November 2012 ● Based on functional programming ● Runs on Windows Forms, WPF, Silverlight, WP7, WP8, JavaScript, ASP.NET ● Is written using extension methods

Why should I use it? ● Today’s applications are complex ● Managing applications with complex message flows, threads and states tend to get real messy real soon ● An asynchronous and responsive UI is a necessity for the demanding users (and apps) of today ● Using a library that handles threading and synchronization for you leads to using fewer locks (and having fewer dead-locks or bottlenecks) ● Allows you to orchestrate message flows in an easy manner

Why should I use it? Events are high-maintenance Enumerating collections is a blocking operation Observables are asynchronous by nature, Observables introduce the notion of time

The assemblies

What you need to know (show me the code) ● The Interfaces ● The Contract OnNext* (OnError | OnCompleted)? Publish next value An Error occured And we’re done

Migrating into the Observable ● Strategy: move tricky problem into observable domain, solve problem easily, move back to regular domain ● Methods exist for converting existing objects to observable objects

Creating Observables ( - what is it really?) ● Think 'streams' (of events, data, etc) ● Do not implement your own IObservable, use available combinators, or the factory methods:

Code Demo – Creating Observables From raw data From events From async patterns Custom observables

Error handling (you be illin’) ● Dissecting the OnError lambda ● Error handling strategy ● Keep it local

Code Demo – Error Handling

Schedulers (time is of the essence) ● Calls are asynchronous, so… ● Where do observables run? ● Observable.Return(42) OnNext(42 ) OnCompleted

Code Demo – Schedulers

Unit Testing (you better check yourself, before you wreck yourself) ● TestScheduler - allows testing of asynchronous code in real-time ● Helps you learn and understand the inner workings of the Rx libraries. ● This is what’s available: ● NewThreadScheduler ● TaskPoolScheduler ● DispatcherScheduler ● ImmediateScheduler ● ThreadPoolScheduler

Code Demo – Testing Schedulers

Resource Disposal (I must clean) ● In Essence: how and when do you Unsubscribe? – OnCompleted AutoDispose ● What happens if you don’t? ● Best practices

Code Demo – Unsubscribe

Hot vs Cold ● There are two types of streams: ● Hot – producing values all the time, regardless of subscribers – Examples: mouse events, streaming data ● Cold – producing values only when someone is subscribing – Examples: web requests ● Important to know the difference, especially when it comes to side effects

Code Demo – Sharing resources hot and cold subjects

Code Demo Search Twitter Common Operators

Why do I recommend Rx? ● Allows me to write modular, reusable code, which is composable ● Allows me to orchestrate message flows ● Relieves me of a lot of state management ● Allows me to write fully asynchronous UI’s from day one. ● Provides full unit testing of timeouts, delays, etc ● Is feature rich => less work for me

Further Reading ● introtorx.com introtorx.com ● ● ●

The End