Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tyrannosaurus Rx
Search
James Hughes
September 03, 2014
Programming
0
110
Tyrannosaurus Rx
Basic overview of Rx (Reactive Extensions)
James Hughes
September 03, 2014
Tweet
Share
More Decks by James Hughes
See All by James Hughes
Functional Programming with Clojure
kouphax
1
100
React
kouphax
2
690
Play for (Java|Scala)
kouphax
0
100
Devops: A Case Study
kouphax
0
65
Scala for C# Developers
kouphax
5
2.5k
Dropwizard - Production Ready Web Services
kouphax
3
1.5k
Scala for Fun & Profit
kouphax
3
610
What Agile Means To Me
kouphax
0
120
Neo4J: A Case Study
kouphax
3
600
Other Decks in Programming
See All in Programming
飲食業界向けマルチプロダクトを実現させる開発体制とリアルな現状
hiroya0601
1
390
macOS でできる リアルタイム動画像処理
biacco42
7
1.8k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
390
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
1.5k
Googleのテストサイズを活用したテスト環境の構築
toms74209200
0
270
Importmapを使ったJavaScriptの 読み込みとブラウザアドオンの影響
swamp09
4
1.2k
Tuning GraphQL on Rails
pyama86
2
1k
Server Driven Compose With Firebase
skydoves
0
400
Go言語でターミナルフレンドリーなAIコマンド、afaを作った/fukuokago20_afa
monochromegane
2
140
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
230
Vue.js学習の振り返り
hiro_xre
2
130
Progressive Web Apps für Desktop und Mobile mit Angular (Hands-on)
christianliebel
PRO
0
110
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.4k
Rails Girls Zürich Keynote
gr2m
93
13k
Docker and Python
trallard
40
3.1k
Building Applications with DynamoDB
mza
90
6.1k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
The Cost Of JavaScript in 2023
addyosmani
45
6.6k
Building Adaptive Systems
keathley
38
2.2k
Bash Introduction
62gerente
608
210k
How STYLIGHT went responsive
nonsquared
95
5.2k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Transcript
TYRANNOSAURUS RX
REACTIVE EXTENSIONS
None
Java JS C# Clojure Groovy Scala Kotlin Python Ruby C++
Haskell
var list = [1,2,3,4,5,6,7]; ! for(var i = 0; i
< list.length; i++) { console.log(list[i]) }
var list = [1,2,3,4,5,6,7]; ! list.forEach(function(item) { console.log(item) })
var list = [Promise(), Promise()…]; ! list.forEach(function(item) { console.log(item.get()) })
TIME RUINS EVERYTHING
None
None
None
OBSERVABLES LISTS WITH TIME REIFIED EVENT STREAM PUSH BASED
CREATING OBSERVABLES ITERABLE FUTURE/PROMISE EVENTS RULES OBSERVABLE
CREATING OBSERVABLES Observable.from(new String[] { "The Joker", "The Riddler", "Penguin",
"Catwoman"})
CREATING OBSERVABLES baddies.subscribe((baddie) -> { out.println(baddie + “ is bad.”)
})
CREATING OBSERVABLES The Joker is bad. The Riddler is bad.
Penguin is bad. Catwoman is bad.
CREATING OBSERVABLES class _ extends Subscriber<String> { void onCompleted() {}
void onError(Throwable t) {} void onNext(String s){} }
CREATING OBSERVABLES onNext("The Joker”)
CREATING OBSERVABLES onNext("The Joker”) onNext("The Riddler”)
CREATING OBSERVABLES onNext("The Joker”) onNext("The Riddler”) onNext(“Penguin")
CREATING OBSERVABLES onNext("The Joker”) onNext("The Riddler”) onNext(“Penguin") onNext(“Catwoman")
CREATING OBSERVABLES onCompleted() onNext("The Joker”) onNext("The Riddler”) onNext(“Penguin") onNext(“Catwoman")
ERROR HANDLING onNext("The Joker”)
onNext("The Joker”) onNext("The Riddler”) ERROR HANDLING
X onNext("The Joker”) onNext("The Riddler”) ERROR HANDLING
X onNext("The Joker”) onNext("The Riddler”) onError(ex) ERROR HANDLING
TRANSFORMING OBSERVABLES TURN AN OBSERVABLE OF ONE TYPE INTO ANOTHER
TRANSFORMING OBSERVABLES Observable ints = Observable .interval(1, SECONDS); ! ints.map((i)
-> i + 1) .map((i) -> i + “ seconds”) .subscribe(out::println)
TRANSFORMING OBSERVABLES map map
TRANSFORMING OBSERVABLES 1 seconds 2 seconds 3 seconds 4 seconds
...
TRANSFORMING OBSERVABLES flatMap(), groupBy(), buffer(), window()
FILTERING OBSERVABLES SELECT AND REJECT ITEMS EMITTED BY AN OBSERVABLE
FILTERING OBSERVABLES var keys = Rx.DOM.keypress(el) var ints = keys.filter(isNumeric)
! ints.subscribe(console.log)
FILTERING OBSERVABLES filter X X
FILTERING OBSERVABLES distinct(), timeout(), ignoreElements(), throttleFirst(), debounce(), sample(), first(), last(),
take(), skip()
COMBINING OBSERVABLES COMPOSING MULTIPLE OBSERVABLES INTO A SINGLE OBSERVABLE
COMBINING OBSERVABLES Observable goodies = Observable.from( new String[]{ "Batman", "Robin",
"Alfred", “Batgirl"}); ! goodies.zipWith(baddies, (g,b) -> g + " punches " + b)
COMBINING OBSERVABLES zipWith
COMBINING OBSERVABLES Batman punches The Joker Robin punches The Riddler
Alfred punches Penguin Batgirl punches Catwoman
STUFF AND OTHER THINGS retry(), delay(), timestamp(), amb(), defaultIfEmpty(), reduce(),
count()
None
TYRANNOSAURUS RX