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
Functional Reactive Programming
Search
Jason Orendorff
March 30, 2013
Programming
10
950
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
100
Meltdown & Spectre
jorendorff
0
40
<textarea distributed>: An illustrated intro to CRDTs
jorendorff
0
43
Cabbages, Goat, and Wolf In Two Styles!!
jorendorff
0
40
John Wark — Design Principles for a High School Coding Curriculum
jorendorff
1
100
Teaching Programming
jorendorff
2
97
goto fail; — Challenges and Considerations for Teaching Programming to Kids
jorendorff
1
58
How To Fix Bugs
jorendorff
0
89
Compilers 101: An introduction to programming languages and parsing
jorendorff
3
750
Other Decks in Programming
See All in Programming
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Symfony Mapper Component
soyuka
2
730
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
Recoilを剥がしている話
kirik
5
6.7k
php-conference-japan-2024
tasuku43
0
270
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
42 best practices for Symfony, a decade later
tucksaun
1
180
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
130
Jakarta EE meets AI
ivargrimstad
0
240
Haze - Real time background blurring
chrisbanes
1
510
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
How STYLIGHT went responsive
nonsquared
95
5.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Designing Experiences People Love
moore
138
23k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Gamification - CAS2011
davidbonilla
80
5.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Into the Great Unknown - MozCon
thekraken
33
1.5k
GitHub's CSS Performance
jonrohan
1030
460k
Music & Morning Musume
bryan
46
6.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
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