Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Functional Reactive Programming
Jason Orendorff
March 30, 2013
Programming
10
930
Functional Reactive Programming
Slides for a talk by Wilkes Joiner at Nashville Code Co-op Talk Day.
Jason Orendorff
March 30, 2013
Tweet
Share
More Decks by Jason Orendorff
See All by Jason Orendorff
Aristotle's Topics
jorendorff
0
25
Meltdown & Spectre
jorendorff
0
22
<textarea distributed>: An illustrated intro to CRDTs
jorendorff
0
17
Cabbages, Goat, and Wolf In Two Styles!!
jorendorff
0
26
John Wark — Design Principles for a High School Coding Curriculum
jorendorff
1
60
Teaching Programming
jorendorff
2
80
goto fail; — Challenges and Considerations for Teaching Programming to Kids
jorendorff
1
44
How To Fix Bugs
jorendorff
0
73
Compilers 101: An introduction to programming languages and parsing
jorendorff
3
710
Other Decks in Programming
See All in Programming
Makuakeの認証基盤とRe-Architectureチーム
bmf_san
0
380
ipa-medit: Memory search and patch tool for IPA without Jailbreaking/ipa-medit-bh2022-europe
tkmru
0
130
Spring BootとKubernetesで実現する今どきのDevOps入門
xblood
0
340
ポケモンで学ぶiOS 16弾丸ツアー 🚅
giginet
PRO
1
610
Remix + Cloudflare Pages + D1 で ポケモン SV のレンタルチームを検索できるアプリを作ってみた
kuroppe1819
4
1.3k
domain層のモジュール化 / MoT TechTalk #15
mot_techtalk
0
110
監視せなあかんし、五大紙だけにオオカミってな🐺🐺🐺🐺🐺
sadnessojisan
2
1.4k
CDKでValidationする本当の方法 / cdk-validation
gotok365
1
190
ECテックカンファレンス2023
kspace
1
220
Micro Frontends with Module Federation @MicroFrontend Summit 2023
manfredsteyer
PRO
0
460
Most Valuable Bug(?) ~インシデント未遂から得た学び~
tatsumiakahori
0
140
Swift Expression Macros: a practical introduction
kishikawakatsumi
2
710
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1351
200k
Thoughts on Productivity
jonyablonski
49
2.7k
Making the Leap to Tech Lead
cromwellryan
116
7.7k
A designer walks into a library…
pauljervisheath
198
16k
Learning to Love Humans: Emotional Interface Design
aarron
263
38k
Testing 201, or: Great Expectations
jmmastey
25
5.7k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
101
6.2k
Code Review Best Practice
trishagee
50
11k
The Pragmatic Product Professional
lauravandoore
21
3.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
44
14k
Fontdeck: Realign not Redesign
paulrobertlloyd
74
4.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
56
2.5k
Transcript
Functional Reactive Programming
“Everything flows, nothing stands still.” Heraclitus
Streams of Events
Streams of Events • Fire and forget events are relatively
easy to create.
Streams of Events • Fire and forget events are relatively
easy to create. • UIs
Streams of Events • Fire and forget events are relatively
easy to create. • UIs • Ajax posts
Streams of Events • Fire and forget events are relatively
easy to create. • UIs • Ajax posts • Messaging queues
Processing Events
Processing Events • A little trickier
Processing Events • A little trickier • difficult to compose
Processing Events • A little trickier • difficult to compose
• lots of plumbing
Processing Events • A little trickier • difficult to compose
• lots of plumbing • Callback Hell
“We’re going to need a bigger boat.”
FRP • A model for values that vary over time
• Originates from Haskell Community • Several different implementation styles • We are focusing on Microsoft’s ReactiveExtenions style
Observable
Observable • A marriage of Iterables and the Observer Pattern
Observable • A marriage of Iterables and the Observer Pattern
• Typical Sequence functions - Map, Filter, Reduce, Take
Observable • A marriage of Iterables and the Observer Pattern
• Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext
Observable • A marriage of Iterables and the Observer Pattern
• Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext • Error Handling
Observable • A marriage of Iterables and the Observer Pattern
• Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext • Error Handling • Timing function - Delay
Observable • A marriage of Iterables and the Observer Pattern
• Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext • Error Handling • Timing function - Delay • Buffering - Last N events
Observable • A marriage of Iterables and the Observer Pattern
• Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext • Error Handling • Timing function - Delay • Buffering - Last N events • Composable - SelectMany/FlatMap
Marble Diagrams
A Marble Diagrams
A Marble Diagrams
A B Marble Diagrams
A B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
A B A.merge(B Marble Diagrams
Autocomplete • On Keyup • Get the value of the
field • Only values of length 3 or more • Make remote call • Filter out bad response • Display results
Autocomplete in reality • On Keyup • Get the value
of the field • Throttle to 500ms • Only values of length 3 or more • Skip duplicates • Make remote call • Filter out bad response • Display results
Demo Source code: https://github.com/Cicayda/yolk-examples