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
Using Future
Search
DAloG
November 01, 2015
Programming
0
85
Using Future
I will try to explore concept of Async state and Future monad
DAloG
November 01, 2015
Tweet
Share
More Decks by DAloG
See All by DAloG
State normalization (RU)
dalog
0
150
Redux + MQTT
dalog
1
730
От задач к проблемам
dalog
1
170
Unlimited power of Data-Driven UI
dalog
4
580
Data-Driven View Controllers. Tips and Tricks
dalog
5
1.7k
2 years of Redux in iOS. Lessons learned
dalog
0
320
Why unidirectional architecture matter for iOS.
dalog
1
260
Mobile backend without REST
dalog
2
72
Self managed teams 101
dalog
0
120
Other Decks in Programming
See All in Programming
一文字エイリアスのすすめ
fujimura
0
190
RailsConf 2024: Riffing on Rails: sketch your way to better designed code
kaspth
1
210
Documentation testsの恩恵 / Documentation testing benefits
ssssota
1
560
ソースコードを美しくたもつために ~コードレビューの認知限界を突破し、年間400リリースを達成する~
kotauchisunsun
1
730
FoodGram
iseruuuuu
0
230
freeeのエンジニアが 就活で出そうな コーディングテストを 解説してみる
freee
1
160
スタックトレース始めてみた
kuro_kurorrr
4
1.1k
WebGLで始める コンピュータグラフィックス入門
heller77
0
370
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
1
120
WinActorの勉強を継続する方法
tamai_63
0
130
Three ways to use AI on Android: The Good, the Bad and the Ugly
marxallski
0
120
The Design of Everyday APIs - PyCon 2024
roguelynn
0
170
Featured
See All Featured
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Unsuck your backbone
ammeep
664
57k
Infographics Made Easy
chrislema
238
18k
Debugging Ruby Performance
tmm1
70
11k
Web Components: a chance to create the future
zenorocha
306
41k
Faster Mobile Websites
deanohume
300
30k
Building Effective Engineering Teams - LeadDev
addyosmani
33
1.9k
Rails Girls Zürich Keynote
gr2m
91
13k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
9
1.3k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Six Lessons from altMBA
skipperchong
22
3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
117
18k
Transcript
USING FUTURES @daloog
ABOUT skype: nobidon
[email protected]
https://speakerdeck.com/dalog
ASYNC VS PARALLEL
ASYNC DO THINGS AT DEFERENT TIME
PARALLEL DO THINGS AT THE SAME TIME
GCD
GCD
NSOPERATION
NSOPERATION
[ _ TARGET: ACTION: ]
DELEGATE
STRATEGY AND CALLBACK
BLOCK
CALLBACK!!!
SIGNATURE DANCE
None
None
None
None
None
None
None
None
None
None
SEPARATE WORK FROM RESULT DELIVERY
SETTER
T -> ()
GETTER
() -> T
T -> U IS (GET, SET) -> ()
T -> U (() -> T, U -> ()) ->
()
None
ASYNC?
ASYNC GETTER
() -> T (T -> ()) -> () SET ->
()
SET<T> -> () FUTURE<T>
ASYNC SETTER
T -> () () -> (T -> ()) () ->
SET
() -> SET<T> PROMISE<T>
GETTER + SETTER = STATE
PROMISE + FUTURE = ASYNC STATE
ASYNC STATE >>> STATE
WHY THIS IS SO HARD???
ACTUALLY NOT
THINK ABOUT FUTURE AS A BOX
BOX WILL BE OPENED. SOMEDAY. MAYBE.
A = B C = A
CHAIN?
T -> U U -> K T -> K
T -> F<U> U -> F<K> T -> F<K>
(F<U> , U -> F<K>) -> F<K>
AND THEN
FLAT MAP
ERROR?
TRY<T, E>
FUTURE<T, E> = FUTURE<TRY<T, E>>
WHAT CAN BE FUTURE?
ANYTHING
UI
USING FUTURES FOR REVERSING UI FLOW. HTTPS://MEDIUM.COM/P/D3F5B7CA32D9/ EDIT
VM -> F<ACTION>
NETWORK BLUETOOTH …
EXPOSE F<> AS PUBLIC API
ALWAYS
USE ANY LIB • https://github.com/BoltsFramework/Bolts-iOS • https://github.com/mxcl/PromiseKit • https://github.com/Thomvis/BrightFutures •
https://realm.io/news/swift-summit-javier-soto-futures/ • https://realm.io/news/swift-tasks-nevyn-bengtsson/
ALL LIBS EQUAL ITS JUST ASYNC STATE
FUTURE / PROMISE ASYNC GET/SET