SlideShare a Scribd company logo
1 of 51
angelo.scotto@computer.org
• Free contest
• innovative
• €20,000
•
• June 30, 2016
• «End of September» 2016:
• Make us proud 
http://bit.ly/efsa_hackathon
MSDN Rx introduction
MSDN Rx introduction
•
•
•
Aggregate<T>
Iterator<T> CreateIterator()
Iterator<T>
void First()
void Next()
bool IsDone()
T CurrentItem()
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
void Reset()
bool MoveNext()
T Current()
Single Multiple
Sync/Pull T
IEnumerable<T>
Iterable of T
Async/Push
Task<T>
Promise<T>
Future<T>
?
Benjamin Franklin
•
•
•
• dual
•
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
bool MoveNext()
T Current()
IDualEnumerable<T>
???
IDualEnumerator<T>
???
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
bool MoveNext()
T Current()
IDualEnumerable<T>
void ???
IDualEnumerator<T>
???
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
bool MoveNext()
T Current()
IDualEnumerable<T>
void ???(IDualEnumerator<T>)
IDualEnumerator<T>
???
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
bool MoveNext()
T Current()
IDualEnumerable<T>
void ???(IDualEnumerator<T>)
IDualEnumerator<T>
void ???
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
bool MoveNext()
T Current()
IDualEnumerable<T>
void ???(IDualEnumerator<T>)
IDualEnumerator<T>
void ???(
T
)
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
bool MoveNext()
T Current()
IDualEnumerable<T>
void ???(IDualEnumerator<T>)
IDualEnumerator<T>
void ???(
bool,
…,
T
)
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
bool MoveNext()
T Current()
IDualEnumerable<T>
void ???(IDualEnumerator<T>)
IDualEnumerator<T>
void ???(
bool,
Exception,
T
)
IEnumerable<T>
IEnumerator<T> GetEnumerator()
IEnumerator<T>
bool MoveNext()
T Current()
IDualEnumerable<T>
void ???(IDualEnumerator<T>)
IDualEnumerator<T>
void OnNext(T)
void OnError(Exception)
void OnComplete()
Subject
void Attach(Observer)
void Detach(Observer)
Notify()
Observer
void Update()
Subject
void Attach(Observer)
void Detach(Observer)
Notify()
Observer
void Update()
Subject<T>
void Attach(Observer<T>)
void Detach(Observer<T>)
Notify(T)
Observer<T>
void Update(T)
Subject<T>
void Attach(Observer<T>)
void Detach(Observer<T>)
Observer<T>
void Update(T)
IDualEnumerable<T>
void ???(IDualEnumerator<T>)
IDualEnumerator<T>
void OnNext(T)
void OnError(Exception)
void OnComplete()
Subject<T>
void Attach(Observer<T>)
void Detach(Observer<T>)
Observer<T>
void Update(T)
IDualEnumerable<T>
void ???(IDualEnumerator<T>)
IDualEnumerator<T>
void OnNext(T)
void OnError(Exception)
void OnComplete()
Subject<T>
void Attach(Observer<T>)
void Detach(Observer<T>)
Observer<T>
void Update(T)
IObservable<T>
void Subscribe(IObserver<T>)
IObserver<T>
void OnNext(T)
void OnError(Exception)
void OnComplete()
Subject<T>
void Attach(Observer<T>)
void Detach(Observer<T>)
Observer<T>
void Update(T)
IObservable<T>
void Subscribe(IObserver<T>)
void Unsubscribe(IObserver<T>)
IObserver<T>
void OnNext(T)
void OnError(Exception)
void OnComplete()
Subject<T>
void Attach(Observer<T>)
void Detach(Observer<T>)
Observer<T>
void Update(T)
IObservable<T>
IDisposable Subscribe(IObserver<T>)
IObserver<T>
void OnNext(T)
void OnError(Exception)
void OnComplete()
IObservable<T>
IDisposable Subscribe(IObserver<T>)
IObserver<T>
void OnNext(T)
void OnError(Exception)
void OnComplete()
•
•
•
Single Multiple
Sync/Pull T
IEnumerable<T>
Iterable of T
Async/Push
Task<T>
Promise<T>
Future<T>
IObservable<T>
Single Multiple
Sync/Pull T
IEnumerable<T>
Iterable of T
Async/Push
Task<T>
Promise<T>
Future<T>
IObservable<T>
•
Single Multiple
Sync/Pull T
IEnumerable<T>
Iterable of T
Async/Push
Task<T>
Promise<T>
Future<T>
IObservable<T>
•
•
Antoine de Saint-Exupéry
http://bit.ly/discoveringrxjs
1.
2. Composition operators & grammar.
3.
Emit only those items from an Observable that
pass a predicate test
0 431 2
0 4
Transform the items emitted by an Observable by
applying a function to each item
0 1 2
0 1
43
2 3 4
Discard any items emitted by an Observable after a
second Observable emits an item or terminates
0 1 2 43
0 1 2
http://bit.ly/discoveringrxjs
Transform the items emitted by an Observable into
Observables, then flatten the emissions from those
into a single Observable
Transform the items emitted by an Observable into
Observables, then flatten the emissions from those
into a single Observable
Transform the items emitted by an Observable into
Observables, then flatten the emissions from those
into a single Observable
Events as Observables
Iterable as Observable
Promise as Observable
http://bit.ly/discoveringrxjs
1.
2.
3. Schedulers and Time.
• Subscribe
subscribeOn
• Observe
observeOn
mainly generators
Scheduler Description
immediate Gets a scheduler that schedules work
immediately on the current thread.
currentThread Gets a scheduler that schedules work
as soon as possible on the current
thread.
default Gets a scheduler that schedules work
via a timed callback based upon
platform.
TestScheduler Virtual time scheduler used for
testing applications and libraries built
using Reactive Extensions.
HistoricalScheduler Provides a virtual time scheduler that
uses a Date for absolute time and
time spans for relative time.
• callback hell
• promises
•
unsubscription/cancellation
• ReactiveX
• LearnRX
• RxJSKoans
• Rx Workshop
• IntroToRx
angelo.scotto@computer.org

More Related Content

More from Angelo Simone Scotto

More from Angelo Simone Scotto (9)

Keep Calm and Distributed Tracing
Keep Calm and Distributed TracingKeep Calm and Distributed Tracing
Keep Calm and Distributed Tracing
 
Rective Programming with Actor Model in .NET
Rective Programming with Actor Model in .NETRective Programming with Actor Model in .NET
Rective Programming with Actor Model in .NET
 
DevOps, Lean and You
DevOps, Lean and YouDevOps, Lean and You
DevOps, Lean and You
 
Agile, DevOps, X-Teams: Is software a social science?
Agile, DevOps, X-Teams: Is software a social science?Agile, DevOps, X-Teams: Is software a social science?
Agile, DevOps, X-Teams: Is software a social science?
 
Taming Asynchrony using RxJS
Taming Asynchrony using RxJSTaming Asynchrony using RxJS
Taming Asynchrony using RxJS
 
Redis Labcamp
Redis LabcampRedis Labcamp
Redis Labcamp
 
Are Microservices our future?
Are Microservices our future?Are Microservices our future?
Are Microservices our future?
 
An Introduction to Machine Learning
An Introduction to Machine LearningAn Introduction to Machine Learning
An Introduction to Machine Learning
 
Actor Model & Reactive Manifesto
Actor Model & Reactive ManifestoActor Model & Reactive Manifesto
Actor Model & Reactive Manifesto
 

Discovering RxJS - MilanoJS Meeting in May 2016