SlideShare a Scribd company logo
1 of 54
Download to read offline
re-frame
Functional Reactive UI Programming
Reactive Programming
Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค.
โ— data flow (<-> control flow)
โ—‹ graph of data
โ— propagation of change
โ— express static or dynamic data flows with ease in the programming
languages used
โ— the underlying execution model will automatically propagate changes
through the data flow
Reactive Programming
control flow data flow
propagation of changeorder of statements
Reactive Programming
Hard Disk
Sector
File
Memory
Data,Time
Data Flow
Abstraction is important
Conceptial Layer
Implementation Layer
Physical Layer
Reactive
Programming
Imperative
Programming
Abstraction
Reactive Programming
โ— x = 10
โ— y = x + 1
โ— print y
; => 11
โ— x = 20
โ— print y
; => 11
โ— y = x + 1
โ— print y
; => 21
โ— x = 10
โ— y = x + 1
โ— print y
; => 11
โ— x = 20
โ— print y
; => 21
imperative reactive
Reactive Programming
โ— x = 10
โ— y = x + 1
โ— print y
; => 11
โ— x = 20
โ— print y
; => 11
โ— y = x + 1
โ— print y
; => 21
imperative
propagation of change
๋ช…์‹œ์ ,
์ˆ˜๋™์ 
์•”๋ฌต์ ,
์ž๋™์ 
โ— x = 10
โ— y = x + 1
โ— print y
; => 11
โ— x = 20
โ— print y
; => 21
reactive
Reactive Programming
โ— x = 10
โ— y = x + 1
โ— print y
; => 11
โ— x = 20
โ— print y
; => 11
โ— y = x + 1
โ— print y
; => 21
โ— x = 10
โ— y = x + 1
โ— print y
; => 11
โ— x = 20
โ— print y
; => 21
imperative reactive
statement definition
Reactive Programming
1
2
3
โ—
โ—
โ—
1
2
3
โ—
โ—
โ—
์ˆ˜ํ–‰
์ˆ˜ํ–‰
์ˆ˜ํ–‰
โ—
โ—
โ—
statement - imperative
Reactive Programming
1
2
3
โ—
โ—
โ—
1
= ( 1
)
2
= ( 2
)
3
= ( 3
)
โ—
โ—
โ—
definition - reactive
= ( )
Reactive Programming
data flow
= ( )
data flow
Reactive Programming
signal
data flow
signal signal
Reactive Programming
Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค.
โ— data flow (<-> control flow)
โ—‹ graph of data
โ— propagation of change
โ— express static or dynamic data flows with ease in the programming
languages used
โ— the underlying execution model will automatically propagate changes
through the data flow
๊ด€๊ณ„(relation)
๊ด€๊ณ„์˜ ์žฌํ˜•์„ฑ
๊ด€๊ณ„์˜ ์ง€์†
Reactive Programming
Hard Disk
Sector
File
Memory
Data,Time
Data Flow
Abstraction is important
Conceptial Layer
Implementation Layer
Physical Layer
Reactive
Programming
Imperative
Programming
Abstraction
๊ด€๊ณ„
Reactive Programming
signal signal
๋ฐ์ดํƒ€๋ฅผ ๋งŒ๋“œ๋Š” ํ•จ์ˆ˜
๊ด€๊ณ„๋ฅผ ๋งŒ๋“œ๋Š” ํ•จ์ˆ˜
Reactive Programming
Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค.
โ— data flow (<-> control flow)
โ—‹ graph of data
โ— propagation of change
โ— express static or dynamic data flows with ease in the programming
languages used
โ— the underlying execution model will automatically propagate changes
through the data flow
Reactive Programming
Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค.
โ— data flow (<-> control flow)
โ—‹ graph of data
โ— propagation of change
โ— express static or dynamic data flows with ease in the programming
languages used
โ— the underlying execution model will automatically propagate changes
through the data flow
FP, Monad
Reactive Programming
Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค.
โ— data flow (<-> control flow)
โ—‹ graph of data
โ— propagation of change
โ— express static or dynamic data flows with ease in the programming
languages used
โ— the underlying execution model will automatically propagate changes
through the data flow
FP, Macro
re-frame
โ— Clojure FRP UI ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
โ— SPA
โ— Motivated
โ—‹ Elm, Flux, Pedestal, Hoplon, Om, Om.Next, Cycle.js
โ— Unidirectional Data Flow
โ— FB react๋ฅผ ๋žฉํ•‘ํ•œ reagent์— ๊ธฐ๋ฐ˜.
โ— MVC ์•„ํ‚คํ…์ณ.
โ—‹ ๊ทธ๋Ÿฌ๋‚˜ ๋‹น์‹ ์ด ์•Œ๊ณ  ์žˆ๋˜ ๊ทธ MVC๋Š” ์•„๋‹ˆ๋‹ค.
โ—‹ ์ฐจ๋ผ๋ฆฌ re-frame ์•„ํ‚คํ…์ณ
โ— Data > Function > Macro
โ—‹ Data์˜ ๊ตฌ์กฐ๋ฅผ ์ž˜ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด Function๋ฅผ ์ž˜ ๋งŒ๋“œ๋Š” ๊ฒƒ๋ณด๋‹ค ์ค‘์š”ํ•˜๋‹ค.
โ—‹ Function์„ ์ž˜ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด Macro๋ฅผ ์ž˜ ๋งŒ๋“œ๋Š” ๊ฒƒ๋ณด๋‹ค ์ค‘์š”ํ•˜๋‹ค.
re-frame
D V
signal signal
FB React
React
Component
Virtual
DOM
Browser
DOM
Browser
Rendering
โ— No Observation
โ— No Monad
โ— No Event
โ— No model dirty checking!
โ— No Data Binding!
โ— Diffing Algorithm
โ— Re-render the whole app on every
update
โ— One Way
re-frame
D V
signal signal
Reagent
React
Component
Virtual
DOM
Browser
DOM
Browser
Rendering
D
signal
Reagent
Component
re-frame
Clojure Vector ์ž๋ฃŒํ˜•
โ— [1 2 3]
โ— [โ€œaโ€ โ€œbโ€ โ€œcโ€]
โ— [:a :b :c]
โ— [:a โ€œaโ€ 1]
โ— [:a {:b 1} {:c 2}]
โ— [:a #(inc %)]
โ— [:button โ€œclick meโ€]
[:h1 โ€œhelloโ€] <h1> hello </h1>
[:button
{:type โ€œbuttonโ€}
โ€œclick meโ€]
<button type=โ€buttonโ€>
click me
</button>
hiccup html
hiccup : Clojure DOM DSL
re-frame
Reagent Componet
(defn hello []
[:h1 โ€œhelloโ€]) hello
Reagent Component Browser
โ— Just a function that returns hiccup.
โ— Not yet signal
โ— Need atom
render โ€œhelloโ€
<h1> hello </h1>
re-frame
Atom : State for Clojure
โ— (def x (atom 1))
โ— @x ;=> 1
โ— (swap! x inc)
โ— @x ;=> 2
โ— (swap! x + 10)
โ— @x ;=> 12
โ— (reset! x 1)
โ— @x ;=> 1
โ— (def x (atom 1))
โ— (defn f [] (prn โ€œx = โ€œ @x))
โ— (f)
;>> โ€œx = 1โ€
โ— (swap! x inc)
โ— (f)
;>> โ€œx = 2โ€
atom ๋งŒ์œผ๋กœ๋Š”
์•Š๋œ๋‹ค.
๋ช…์‹œ์ ์œผ๋กœ
ํ˜ธ์ถœํ•ด์ค˜์•ผ...
๋ณ€๊ฒฝํ–ˆ์ง€
๋งŒ
re-frame
Ratom : State for Reagent
โ— Clojure์˜ Atom๊ณผ ๋ชจ๋“  ๊ธฐ๋Šฅ์„ ๋˜‘๊ฐ™๋‹ค.
โ— Reagent Component์˜ State๋กœ์„œ ๋™์ž‘ํ•˜๋„๋ก ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋˜์—ˆ๋‹ค.
โ— reagent๊ฐ€ mountํ•  ๋•Œ, Ratom์„ ์‚ฌ์šฉํ•˜๋Š” ํ•จ์ˆ˜๋Š” reagent
component๊ฐ€ ๋“ฑ๋กํ•˜๊ฒŒ ๋œ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•ด์„œ signal์ด ๋œ๋‹ค.
โ— (def x (r/atom 1))
โ— @x ;=> 1
โ— (swap! x inc)
โ— @x ;=> 2
โ— (swap! x + 10)
โ— @x ;=> 12
โ— (reset! x 1)
โ— @x ;=> 1
โ— (def x (r/atom 1))
โ— (defn f [] (prn โ€œx = โ€œ @x))
โ— ; reagent mount f as component
โ— (swap! x inc)
;>> โ€œx = 2โ€
๋ณ€๊ฒฝํ•˜
๋ฉด
์ž๋™์œผ๋กœ
ํ˜ธ์ถœ๋œ๋‹ค
re-frame
DEMO
1
Clojure Atom vs. Reagent Atom
re-frame
Reagent component
โ— ํ™”๋ฉด์„ ๊ตฌ์„ฑํ•œ๋‹ค๋Š” ๊ฒƒ์€ ๊ณง ๋ฐ์ดํƒ€๋ฅผ ๊ตฌ์„ฑํ•œ๋‹ค๋Š”
๊ฒƒ
โ— ๋ฐ์ดํƒ€ ์กฐ์ž‘๋งŒ์œผ๋กœ ํ™”๋ฉด์„ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค!
D V
signal signal
D
signal
Ratom
re-frame
DEMO
2
Two circles with ratom
re-frame
Reagent component
D V
signal signal
D
signal
Ratom
Reagent component
D V
signal signal
D
signal
Ratom
2 Ratom ์‚ฌ์ด์— ๊ด€๊ณ„๊ฐ€
์—†๋‹ค.
re-frame
Reagent component
D V
signal signal
D
signal
Ratom
Reagent component
D V
signal signal
D
signal
Ratom
2 Ratom ์‚ฌ์ด์— ๊ด€๊ณ„๊ฐ€ ์žˆ์–ด์•ผโ€ฆ
์ฆ‰ ํ•œ Ratom์˜ ๋ณ€ํ™”๊ฐ€ ๋‹ค๋ฅธ Ratom์—
์ „ํŒŒ๋˜์–ด์•ผ...
re-frame
Reagent component
D V
signal signal
D
signal
Ratom
Reagent component
D V
signal signal
D
signal
Ratom
๊ทธ๋Ÿฌ๋‚˜ Ratom์—๋Š” ์ด๋Ÿฐ ๊ธฐ๋Šฅ์ด ์—†๋‹ค.
โ•ณ
re-frame
Reagent component
D V
signal signal
D
signal
Ratom
Reagent component
D V
signal signal
D
signal
Reaction
Reaction์ด ๊ทธ ์—ญํ• ์„ ํ•  ์ˆ˜ ์žˆ๋‹ค.
Reaction
re-frame
DEMO
3
Reaction
re-frame
Reagent component
D V
signal signal
D
signal
Ratom
Reagent component
D V
signal signal
D
signal
Reaction
Data Flow Graph !!!
Reaction
re-frame
DEMO
4
Two circles with reaction
re-frame
Reagent component
D V
signal signalD
signal
Ratom
Reagent component
D V
signal signal
D
signal
Reaction
Reaction์€ ๋‹ค์ˆ˜์˜ ์‹œ๊ทธ๋„์„ ๊ฒฐํ•ฉํ•ด์„œ ๊ณ„์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ๋ฆฌํ„ดํ•  ์ˆ˜
์žˆ๋‹ค.
D
signal
Ratom
Reaction ์˜ ์žฅ์  1
re-frame
DEMO
5
Circle rotates circle
re-frame
Reagent component
D V
signal signal
D
signal
Ratom
Reagent component
D V
signal signal
D
signal
Reaction
Reaction ์˜ ์žฅ์  2
Reaction์€ ๊ด€์‹ฌ์žˆ๋Š” ๋ถ€๋ถ„์˜ ๋ณ€ํ™”๋งŒ ์ „ํŒŒํ•  ์ˆ˜
์žˆ๋‹ค.
part
part
re-frame
DEMO
6
Propagation of Parts
re-frame
D V
D
D VD
๋‹จ์ : Ratom, Reaction
์‹œ์Šคํ…œ์ด ์ปค์ง€๋ฉด ์œ„ ๊ทธ๋ฆผ์ฒ˜๋Ÿผ Graph๊ฐ€
๋ณต์žกํ•ด์ง„๋‹ค.
D V
D
D VD
D V
D
D VD
D V
D
D VD
re-frame
D V
app-db
Ratom
D VD
One Big Ratom
app-db
D V
D VD
re-frame
app-db
โ— โ€œWell-formed Data at rest is as close to perfection in programming as it gets.โ€
โ€” Fogus (@fogus) April 11, 2014
โ— in-memory database
โ— OOP์™€๋Š” ๊ทน๋ช…ํ•˜๊ฒŒ ๋Œ€์น˜๋˜๋Š” ์ง€์ 
โ—‹ Local state is harmful.
โ—‹ State considered harmful.
โ—‹ Global์ด๋ƒ Local์ด๋ƒ๊ฐ€ ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ๋ผ, State๋ฅผ ์ตœ๋Œ€ํ•œ ์ค„์ด๊ณ  ์ž˜ ๋‹ค๋ฃจ๋Š” ๊ฒƒ์ด
์ค‘์š”ํ•˜๋‹ค.
โ— ์žฅ์ 
โ—‹ application state์˜ ๋™๊ธฐํ™”๊ฐ€ ์‰ฝ๋‹ค.
โ—‹ Undo/Redo ๊ตฌํ˜„์ด ์‰ฝ๋‹ค.
โ—‹ application ์„ FSM์œผ๋กœ ๋ชจ๋ธ๋งํ•  ์ˆ˜ ์žˆ๋‹ค.
โ—
re-frame
app-db components Hiccup Reagent VDOM React DOM
f1 f2 f3
unidirectional, dynamic, async, discrete FRP data flow
re-frame
app-db components Hiccup Reagent VDOM React DOM
f1 f2 f3
Browser pixels Monitor photons
f4 f5
unidirectional, dynamic, async, discrete FRP data flow
continued...
re-frame
app-db components Hiccup Reagent VDOM React DOM
f1 f2 f3
Browser pixels Monitor photons
f4 f5
unidirectional, dynamic, async, discrete FRP data flow
continued...
re-frame
Subscription
app-db Component
query
reaction
re-frame
Subscription
โ— loosely coupling
โ—‹ Component๋Š” app-db์— ๋Œ€ํ•ด ์ตœ์†Œํ•œ์˜ ์ •๋ณด๋งŒ ์•Œ์•„์•ผ ํ•œ๋‹ค.
โ—‹ ์„ ์–ธ์  ๋ฐฉ์‹์œผ๋กœ reaction์„ ์š”์ฒญํ•œ๋‹ค.
โ—‹ ํ•˜๋‚˜์˜ Component๋Š” ์กฐ๊ฑด์— ๋”ฐ๋ผ ๋‹ค๋ฅธ reaction์— ๊ด€๊ณ„.
โ— pameteryzed query
โ— app-db๋Š” ๋ฐ์ดํƒ€๋ฒ ์ด์Šค๋‹ค.
โ— re-frame์˜ subscription์€ ์ด ์—ญํ• ์„ ์ˆ˜ํ–‰ํ•œ๋‹ค.
โ— register-sub ํ•จ์ˆ˜ : ํ‚ค์›Œ๋“œ๋กœ Subscription ๋“ฑ๋ก
โ— subscribe ํ•จ์ˆ˜ : ํ‚ค์›Œ๋“œ๋กœ ์ง€์ •๋œ reaction์„ ๋ฆฌํ„ดํ•œ๋‹ค.
re-frame
Subscription
(register-sub :customer-query
(fn []
[db [sid cid]]
(reaction (get-in @db [:path :to :a :map cid])))
(subscribe [:customer-query])
UI ์ฝ”๋“œ์—์„œ ์‚ฌ์šฉ.
UI ๊ด€์ ์—์„œ ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ์„ ์–ธ์ ์œผ๋กœ query๋ฅผ
์š”์ฒญ.
app-db์— ๋Œ€ํ•œ ๊ตฌ์ฒด์ ์ธ ์ง€์‹์ด ํ•„์š”์—†๋‹ค.
DB ์ฝ”๋“œ์— ์กด์žฌ.
app-db์— ๋Œ€ํ•œ ์ง€์‹ ์ •๋ณด
ํ•„์š”.
์š”์ฒญ๋œ query๋ฅผ ์ˆ˜ํ–‰ํ•œ ํ›„,
reaction์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.
re-frame
DEMO
7
Subscriptions
re-frame
app-db components Hiccup Reagent VDOM React DOM
f1 f2 f3
Dispatch events
eventhandler
re-frame
Dispatch events
โ— events is data.
โ— 2nd flow, reverse flow
โ— mouse click, ajax
โ— mutate app-db
โ—‹ Component๋Š” app-db์— ๋Œ€ํ•ด ์ตœ์†Œํ•œ์˜ ์ •๋ณด๋งŒ ์•Œ์•„์•ผ ํ•œ๋‹ค.
โ—‹ ์„ ์–ธ์  ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝ์„ ์š”์ฒญํ•œ๋‹ค.
โ— register-handler ํ•จ์ˆ˜ : ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ ๋“ฑ๋ก. ํ•ธ๋“ค๋Ÿฌ ํ•จ์ˆ˜๋Š” app-db๋ฅผ ๋ณ€๊ฒฝ.
โ— dispatch : ์ด๋ฒคํŠธ ๋ฐœ์ƒ
โ— app-db๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๋ชจ๋“  ์ฝ”๋“œ๋Š” ํ•ธ๋“ค๋Ÿฌ ํ•จ์ˆ˜๋“ค ์•ˆ์— ์กด์žฌํ•˜๊ฒŒ ๋œ๋‹ค.
โ—‹ ๋”ฐ๋ผ์„œ ์–ด๋Š ์ง€์ ์—์„œ ์–ด๋–ค ๋ณ€๊ฒฝ์ด ์žˆ๋Š”์ง€๋ฅผ ์‰ฝ๊ฒŒ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
re-frame
Dispatch events
(register-handler :delete-item
(fn [app-db [hid item-id]]
(dissoc-in app-db [:some :path item-id]))
(dispatch [:delete-item 42])
UI ์ชฝ ์ฝ”๋“œ์— ์กด์žฌ.
๋ณ€๊ฒฝ ์š”์ฒญ์— ๋Œ€ํ•œ
์„ ์–ธ.
๊ตฌ์ฒด์ ์ธ ๊ตฌํ˜„๊ณผ๋Š”
๋ฌด๊ด€.
DB ์ชฝ์— ์กด์žฌ
app-db์— ๋Œ€ํ•œ ์ง€์‹์„
์•ˆ๋‹ค.
๊ตฌ์ฒด์ ์ธ ๋ณ€๊ฒฝ์„ ์ˆ˜ํ–‰ํ•œ๋‹ค.
re-frame
DEMO
8
Dispatch events
END
QnA

More Related Content

Similar to Re frame

Custom DevOps Monitoring System in MelOn (with InfluxDB + Telegraf + Grafana)
Custom DevOps Monitoring System in MelOn (with InfluxDB + Telegraf + Grafana)Custom DevOps Monitoring System in MelOn (with InfluxDB + Telegraf + Grafana)
Custom DevOps Monitoring System in MelOn (with InfluxDB + Telegraf + Grafana)Seungmin Yu
ย 
Monitoring System for DevOps - Case of MelOn
Monitoring System for DevOps - Case of MelOnMonitoring System for DevOps - Case of MelOn
Monitoring System for DevOps - Case of MelOnDataya Nolja
ย 
Rx java intro
Rx java introRx java intro
Rx java introYoung-Hyuk Yoo
ย 
[NDC17] Unreal.js - ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์‰ฝ๊ณ  ๋น ๋ฅธ UE4 ๊ฐœ๋ฐœํ•˜๊ธฐ
[NDC17] Unreal.js - ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์‰ฝ๊ณ  ๋น ๋ฅธ UE4 ๊ฐœ๋ฐœํ•˜๊ธฐ[NDC17] Unreal.js - ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์‰ฝ๊ณ  ๋น ๋ฅธ UE4 ๊ฐœ๋ฐœํ•˜๊ธฐ
[NDC17] Unreal.js - ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์‰ฝ๊ณ  ๋น ๋ฅธ UE4 ๊ฐœ๋ฐœํ•˜๊ธฐํ˜„์ฒ  ์กฐ
ย 
[KGC2014] DX9์—์„œDX11๋กœ์˜์ดํ–‰๊ฒฝํ—˜๊ณต์œ 
[KGC2014] DX9์—์„œDX11๋กœ์˜์ดํ–‰๊ฒฝํ—˜๊ณต์œ [KGC2014] DX9์—์„œDX11๋กœ์˜์ดํ–‰๊ฒฝํ—˜๊ณต์œ 
[KGC2014] DX9์—์„œDX11๋กœ์˜์ดํ–‰๊ฒฝํ—˜๊ณต์œ Hwan Min
ย 
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - 3์žฅ. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - 3์žฅ. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - 3์žฅ. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - 3์žฅ. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐHyunsoo Jung
ย 
[0312 ์กฐ์ง„ํ˜„] good bye dx9
[0312 ์กฐ์ง„ํ˜„] good bye dx9[0312 ์กฐ์ง„ํ˜„] good bye dx9
[0312 ์กฐ์ง„ํ˜„] good bye dx9์ง„ํ˜„ ์กฐ
ย 
Tips and experience_of_dx12_engine_development._ver_1.2
Tips and experience_of_dx12_engine_development._ver_1.2Tips and experience_of_dx12_engine_development._ver_1.2
Tips and experience_of_dx12_engine_development._ver_1.2YEONG-CHEON YOU
ย 
2016 W3C Conference #6 : ReactiveX + Meteor ์ข…๋‹จ๊ฐ„ ์•”ํ˜ธํ™” ๊ตฌํ˜„ ์‚ฌ๋ก€
2016 W3C Conference #6 : ReactiveX + Meteor ์ข…๋‹จ๊ฐ„ ์•”ํ˜ธํ™” ๊ตฌํ˜„ ์‚ฌ๋ก€2016 W3C Conference #6 : ReactiveX + Meteor ์ข…๋‹จ๊ฐ„ ์•”ํ˜ธํ™” ๊ตฌํ˜„ ์‚ฌ๋ก€
2016 W3C Conference #6 : ReactiveX + Meteor ์ข…๋‹จ๊ฐ„ ์•”ํ˜ธํ™” ๊ตฌํ˜„ ์‚ฌ๋ก€์–‘์žฌ๋™ ์ฝ”๋“œ๋žฉ
ย 
๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ์„ธ๋ฏธ๋‚˜ tensor-flow
๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ์„ธ๋ฏธ๋‚˜ tensor-flow๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ์„ธ๋ฏธ๋‚˜ tensor-flow
๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ์„ธ๋ฏธ๋‚˜ tensor-flow์–‘ ํ•œ๋น›
ย 
RHQ ๊ณต๊ฐ Seminar 6th
RHQ ๊ณต๊ฐ Seminar 6thRHQ ๊ณต๊ฐ Seminar 6th
RHQ ๊ณต๊ฐ Seminar 6thTed Won
ย 
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 1. ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์ถœ๋ ฅ
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 1. ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์ถœ๋ ฅ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 1. ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์ถœ๋ ฅ
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 1. ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์ถœ๋ ฅnemoux
ย 
GDG 2014 - RxJava๋ฅผ ํ™œ์šฉํ•œ Functional Reactive Programming
GDG 2014 - RxJava๋ฅผ ํ™œ์šฉํ•œ Functional Reactive Programming GDG 2014 - RxJava๋ฅผ ํ™œ์šฉํ•œ Functional Reactive Programming
GDG 2014 - RxJava๋ฅผ ํ™œ์šฉํ•œ Functional Reactive Programming waynejo
ย 
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdfChris Hoyean Song
ย 
Tips and experience of DX12 Engine development .
Tips and experience of DX12 Engine development .Tips and experience of DX12 Engine development .
Tips and experience of DX12 Engine development .YEONG-CHEON YOU
ย 
05.์‹คํ–‰ํ™˜๊ฒฝ ๊ต์œก๊ต์žฌ(์—…๋ฌด์ฒ˜๋ฆฌ,์—ฐ๊ณ„ํ†ตํ•ฉ)
05.์‹คํ–‰ํ™˜๊ฒฝ ๊ต์œก๊ต์žฌ(์—…๋ฌด์ฒ˜๋ฆฌ,์—ฐ๊ณ„ํ†ตํ•ฉ)05.์‹คํ–‰ํ™˜๊ฒฝ ๊ต์œก๊ต์žฌ(์—…๋ฌด์ฒ˜๋ฆฌ,์—ฐ๊ณ„ํ†ตํ•ฉ)
05.์‹คํ–‰ํ™˜๊ฒฝ ๊ต์œก๊ต์žฌ(์—…๋ฌด์ฒ˜๋ฆฌ,์—ฐ๊ณ„ํ†ตํ•ฉ)Hankyo
ย 
Advanced nGrinder
Advanced nGrinderAdvanced nGrinder
Advanced nGrinderJunHo Yoon
ย 
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 2. แ„‹แ…ฑแ†ซแ„ƒแ…ฉแ„‹แ…ฎ แ„†แ…ขแ„‚แ…ตแ„Œแ…ฅ แ„Žแ…ฌแ„Œแ…ฅแ†จแ„’แ…ช
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 2. แ„‹แ…ฑแ†ซแ„ƒแ…ฉแ„‹แ…ฎ แ„†แ…ขแ„‚แ…ตแ„Œแ…ฅ แ„Žแ…ฌแ„Œแ…ฅแ†จแ„’แ…ช์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 2. แ„‹แ…ฑแ†ซแ„ƒแ…ฉแ„‹แ…ฎ แ„†แ…ขแ„‚แ…ตแ„Œแ…ฅ แ„Žแ…ฌแ„Œแ…ฅแ†จแ„’แ…ช
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 2. แ„‹แ…ฑแ†ซแ„ƒแ…ฉแ„‹แ…ฎ แ„†แ…ขแ„‚แ…ตแ„Œแ…ฅ แ„Žแ…ฌแ„Œแ…ฅแ†จแ„’แ…ชnemoux
ย 

Similar to Re frame (20)

Custom DevOps Monitoring System in MelOn (with InfluxDB + Telegraf + Grafana)
Custom DevOps Monitoring System in MelOn (with InfluxDB + Telegraf + Grafana)Custom DevOps Monitoring System in MelOn (with InfluxDB + Telegraf + Grafana)
Custom DevOps Monitoring System in MelOn (with InfluxDB + Telegraf + Grafana)
ย 
Monitoring System for DevOps - Case of MelOn
Monitoring System for DevOps - Case of MelOnMonitoring System for DevOps - Case of MelOn
Monitoring System for DevOps - Case of MelOn
ย 
Rx java intro
Rx java introRx java intro
Rx java intro
ย 
What is the meteor?
What is the meteor?What is the meteor?
What is the meteor?
ย 
[NDC17] Unreal.js - ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์‰ฝ๊ณ  ๋น ๋ฅธ UE4 ๊ฐœ๋ฐœํ•˜๊ธฐ
[NDC17] Unreal.js - ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์‰ฝ๊ณ  ๋น ๋ฅธ UE4 ๊ฐœ๋ฐœํ•˜๊ธฐ[NDC17] Unreal.js - ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์‰ฝ๊ณ  ๋น ๋ฅธ UE4 ๊ฐœ๋ฐœํ•˜๊ธฐ
[NDC17] Unreal.js - ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์‰ฝ๊ณ  ๋น ๋ฅธ UE4 ๊ฐœ๋ฐœํ•˜๊ธฐ
ย 
[KGC2014] DX9์—์„œDX11๋กœ์˜์ดํ–‰๊ฒฝํ—˜๊ณต์œ 
[KGC2014] DX9์—์„œDX11๋กœ์˜์ดํ–‰๊ฒฝํ—˜๊ณต์œ [KGC2014] DX9์—์„œDX11๋กœ์˜์ดํ–‰๊ฒฝํ—˜๊ณต์œ 
[KGC2014] DX9์—์„œDX11๋กœ์˜์ดํ–‰๊ฒฝํ—˜๊ณต์œ 
ย 
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - 3์žฅ. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - 3์žฅ. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - 3์žฅ. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ
7๊ฐ€์ง€ ๋™์‹œ์„ฑ ๋ชจ๋ธ - 3์žฅ. ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ
ย 
[0312 ์กฐ์ง„ํ˜„] good bye dx9
[0312 ์กฐ์ง„ํ˜„] good bye dx9[0312 ์กฐ์ง„ํ˜„] good bye dx9
[0312 ์กฐ์ง„ํ˜„] good bye dx9
ย 
Tips and experience_of_dx12_engine_development._ver_1.2
Tips and experience_of_dx12_engine_development._ver_1.2Tips and experience_of_dx12_engine_development._ver_1.2
Tips and experience_of_dx12_engine_development._ver_1.2
ย 
2016 W3C Conference #6 : ReactiveX + Meteor ์ข…๋‹จ๊ฐ„ ์•”ํ˜ธํ™” ๊ตฌํ˜„ ์‚ฌ๋ก€
2016 W3C Conference #6 : ReactiveX + Meteor ์ข…๋‹จ๊ฐ„ ์•”ํ˜ธํ™” ๊ตฌํ˜„ ์‚ฌ๋ก€2016 W3C Conference #6 : ReactiveX + Meteor ์ข…๋‹จ๊ฐ„ ์•”ํ˜ธํ™” ๊ตฌํ˜„ ์‚ฌ๋ก€
2016 W3C Conference #6 : ReactiveX + Meteor ์ข…๋‹จ๊ฐ„ ์•”ํ˜ธํ™” ๊ตฌํ˜„ ์‚ฌ๋ก€
ย 
๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ์„ธ๋ฏธ๋‚˜ tensor-flow
๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ์„ธ๋ฏธ๋‚˜ tensor-flow๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ์„ธ๋ฏธ๋‚˜ tensor-flow
๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ๊ณต๊ฐ์„ธ๋ฏธ๋‚˜ tensor-flow
ย 
RHQ ๊ณต๊ฐ Seminar 6th
RHQ ๊ณต๊ฐ Seminar 6thRHQ ๊ณต๊ฐ Seminar 6th
RHQ ๊ณต๊ฐ Seminar 6th
ย 
Modern android
Modern androidModern android
Modern android
ย 
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 1. ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์ถœ๋ ฅ
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 1. ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์ถœ๋ ฅ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 1. ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์ถœ๋ ฅ
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 1. ์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์ถœ๋ ฅ
ย 
GDG 2014 - RxJava๋ฅผ ํ™œ์šฉํ•œ Functional Reactive Programming
GDG 2014 - RxJava๋ฅผ ํ™œ์šฉํ•œ Functional Reactive Programming GDG 2014 - RxJava๋ฅผ ํ™œ์šฉํ•œ Functional Reactive Programming
GDG 2014 - RxJava๋ฅผ ํ™œ์šฉํ•œ Functional Reactive Programming
ย 
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
[KR] Building modern data pipeline with Snowflake + DBT + Airflow.pdf
ย 
Tips and experience of DX12 Engine development .
Tips and experience of DX12 Engine development .Tips and experience of DX12 Engine development .
Tips and experience of DX12 Engine development .
ย 
05.์‹คํ–‰ํ™˜๊ฒฝ ๊ต์œก๊ต์žฌ(์—…๋ฌด์ฒ˜๋ฆฌ,์—ฐ๊ณ„ํ†ตํ•ฉ)
05.์‹คํ–‰ํ™˜๊ฒฝ ๊ต์œก๊ต์žฌ(์—…๋ฌด์ฒ˜๋ฆฌ,์—ฐ๊ณ„ํ†ตํ•ฉ)05.์‹คํ–‰ํ™˜๊ฒฝ ๊ต์œก๊ต์žฌ(์—…๋ฌด์ฒ˜๋ฆฌ,์—ฐ๊ณ„ํ†ตํ•ฉ)
05.์‹คํ–‰ํ™˜๊ฒฝ ๊ต์œก๊ต์žฌ(์—…๋ฌด์ฒ˜๋ฆฌ,์—ฐ๊ณ„ํ†ตํ•ฉ)
ย 
Advanced nGrinder
Advanced nGrinderAdvanced nGrinder
Advanced nGrinder
ย 
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 2. แ„‹แ…ฑแ†ซแ„ƒแ…ฉแ„‹แ…ฎ แ„†แ…ขแ„‚แ…ตแ„Œแ…ฅ แ„Žแ…ฌแ„Œแ…ฅแ†จแ„’แ…ช
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 2. แ„‹แ…ฑแ†ซแ„ƒแ…ฉแ„‹แ…ฎ แ„†แ…ขแ„‚แ…ตแ„Œแ…ฅ แ„Žแ…ฌแ„Œแ…ฅแ†จแ„’แ…ช์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 2. แ„‹แ…ฑแ†ซแ„ƒแ…ฉแ„‹แ…ฎ แ„†แ…ขแ„‚แ…ตแ„Œแ…ฅ แ„Žแ…ฌแ„Œแ…ฅแ†จแ„’แ…ช
์œˆ๋„์šฐ ๋งค๋‹ˆ์ € ์Šคํ„ฐ๋””: 2. แ„‹แ…ฑแ†ซแ„ƒแ…ฉแ„‹แ…ฎ แ„†แ…ขแ„‚แ…ตแ„Œแ…ฅ แ„Žแ…ฌแ„Œแ…ฅแ†จแ„’แ…ช
ย 

Re frame

  • 2. Reactive Programming Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค. โ— data flow (<-> control flow) โ—‹ graph of data โ— propagation of change โ— express static or dynamic data flows with ease in the programming languages used โ— the underlying execution model will automatically propagate changes through the data flow
  • 3. Reactive Programming control flow data flow propagation of changeorder of statements
  • 4. Reactive Programming Hard Disk Sector File Memory Data,Time Data Flow Abstraction is important Conceptial Layer Implementation Layer Physical Layer Reactive Programming Imperative Programming Abstraction
  • 5. Reactive Programming โ— x = 10 โ— y = x + 1 โ— print y ; => 11 โ— x = 20 โ— print y ; => 11 โ— y = x + 1 โ— print y ; => 21 โ— x = 10 โ— y = x + 1 โ— print y ; => 11 โ— x = 20 โ— print y ; => 21 imperative reactive
  • 6. Reactive Programming โ— x = 10 โ— y = x + 1 โ— print y ; => 11 โ— x = 20 โ— print y ; => 11 โ— y = x + 1 โ— print y ; => 21 imperative propagation of change ๋ช…์‹œ์ , ์ˆ˜๋™์  ์•”๋ฌต์ , ์ž๋™์  โ— x = 10 โ— y = x + 1 โ— print y ; => 11 โ— x = 20 โ— print y ; => 21 reactive
  • 7. Reactive Programming โ— x = 10 โ— y = x + 1 โ— print y ; => 11 โ— x = 20 โ— print y ; => 11 โ— y = x + 1 โ— print y ; => 21 โ— x = 10 โ— y = x + 1 โ— print y ; => 11 โ— x = 20 โ— print y ; => 21 imperative reactive statement definition
  • 9. Reactive Programming 1 2 3 โ— โ— โ— 1 = ( 1 ) 2 = ( 2 ) 3 = ( 3 ) โ— โ— โ— definition - reactive = ( )
  • 12. Reactive Programming Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค. โ— data flow (<-> control flow) โ—‹ graph of data โ— propagation of change โ— express static or dynamic data flows with ease in the programming languages used โ— the underlying execution model will automatically propagate changes through the data flow ๊ด€๊ณ„(relation) ๊ด€๊ณ„์˜ ์žฌํ˜•์„ฑ ๊ด€๊ณ„์˜ ์ง€์†
  • 13. Reactive Programming Hard Disk Sector File Memory Data,Time Data Flow Abstraction is important Conceptial Layer Implementation Layer Physical Layer Reactive Programming Imperative Programming Abstraction ๊ด€๊ณ„
  • 14. Reactive Programming signal signal ๋ฐ์ดํƒ€๋ฅผ ๋งŒ๋“œ๋Š” ํ•จ์ˆ˜ ๊ด€๊ณ„๋ฅผ ๋งŒ๋“œ๋Š” ํ•จ์ˆ˜
  • 15. Reactive Programming Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค. โ— data flow (<-> control flow) โ—‹ graph of data โ— propagation of change โ— express static or dynamic data flows with ease in the programming languages used โ— the underlying execution model will automatically propagate changes through the data flow
  • 16. Reactive Programming Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค. โ— data flow (<-> control flow) โ—‹ graph of data โ— propagation of change โ— express static or dynamic data flows with ease in the programming languages used โ— the underlying execution model will automatically propagate changes through the data flow FP, Monad
  • 17. Reactive Programming Wikipedia ์˜ ์ฒซ ๊ตฌ์ ˆ์— ์ž˜ ํ‘œํ˜„๋˜์–ด ์žˆ๋‹ค. โ— data flow (<-> control flow) โ—‹ graph of data โ— propagation of change โ— express static or dynamic data flows with ease in the programming languages used โ— the underlying execution model will automatically propagate changes through the data flow FP, Macro
  • 18. re-frame โ— Clojure FRP UI ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ โ— SPA โ— Motivated โ—‹ Elm, Flux, Pedestal, Hoplon, Om, Om.Next, Cycle.js โ— Unidirectional Data Flow โ— FB react๋ฅผ ๋žฉํ•‘ํ•œ reagent์— ๊ธฐ๋ฐ˜. โ— MVC ์•„ํ‚คํ…์ณ. โ—‹ ๊ทธ๋Ÿฌ๋‚˜ ๋‹น์‹ ์ด ์•Œ๊ณ  ์žˆ๋˜ ๊ทธ MVC๋Š” ์•„๋‹ˆ๋‹ค. โ—‹ ์ฐจ๋ผ๋ฆฌ re-frame ์•„ํ‚คํ…์ณ โ— Data > Function > Macro โ—‹ Data์˜ ๊ตฌ์กฐ๋ฅผ ์ž˜ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด Function๋ฅผ ์ž˜ ๋งŒ๋“œ๋Š” ๊ฒƒ๋ณด๋‹ค ์ค‘์š”ํ•˜๋‹ค. โ—‹ Function์„ ์ž˜ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด Macro๋ฅผ ์ž˜ ๋งŒ๋“œ๋Š” ๊ฒƒ๋ณด๋‹ค ์ค‘์š”ํ•˜๋‹ค.
  • 19. re-frame D V signal signal FB React React Component Virtual DOM Browser DOM Browser Rendering โ— No Observation โ— No Monad โ— No Event โ— No model dirty checking! โ— No Data Binding! โ— Diffing Algorithm โ— Re-render the whole app on every update โ— One Way
  • 21. re-frame Clojure Vector ์ž๋ฃŒํ˜• โ— [1 2 3] โ— [โ€œaโ€ โ€œbโ€ โ€œcโ€] โ— [:a :b :c] โ— [:a โ€œaโ€ 1] โ— [:a {:b 1} {:c 2}] โ— [:a #(inc %)] โ— [:button โ€œclick meโ€] [:h1 โ€œhelloโ€] <h1> hello </h1> [:button {:type โ€œbuttonโ€} โ€œclick meโ€] <button type=โ€buttonโ€> click me </button> hiccup html hiccup : Clojure DOM DSL
  • 22. re-frame Reagent Componet (defn hello [] [:h1 โ€œhelloโ€]) hello Reagent Component Browser โ— Just a function that returns hiccup. โ— Not yet signal โ— Need atom render โ€œhelloโ€ <h1> hello </h1>
  • 23. re-frame Atom : State for Clojure โ— (def x (atom 1)) โ— @x ;=> 1 โ— (swap! x inc) โ— @x ;=> 2 โ— (swap! x + 10) โ— @x ;=> 12 โ— (reset! x 1) โ— @x ;=> 1 โ— (def x (atom 1)) โ— (defn f [] (prn โ€œx = โ€œ @x)) โ— (f) ;>> โ€œx = 1โ€ โ— (swap! x inc) โ— (f) ;>> โ€œx = 2โ€ atom ๋งŒ์œผ๋กœ๋Š” ์•Š๋œ๋‹ค. ๋ช…์‹œ์ ์œผ๋กœ ํ˜ธ์ถœํ•ด์ค˜์•ผ... ๋ณ€๊ฒฝํ–ˆ์ง€ ๋งŒ
  • 24. re-frame Ratom : State for Reagent โ— Clojure์˜ Atom๊ณผ ๋ชจ๋“  ๊ธฐ๋Šฅ์„ ๋˜‘๊ฐ™๋‹ค. โ— Reagent Component์˜ State๋กœ์„œ ๋™์ž‘ํ•˜๋„๋ก ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋˜์—ˆ๋‹ค. โ— reagent๊ฐ€ mountํ•  ๋•Œ, Ratom์„ ์‚ฌ์šฉํ•˜๋Š” ํ•จ์ˆ˜๋Š” reagent component๊ฐ€ ๋“ฑ๋กํ•˜๊ฒŒ ๋œ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•ด์„œ signal์ด ๋œ๋‹ค. โ— (def x (r/atom 1)) โ— @x ;=> 1 โ— (swap! x inc) โ— @x ;=> 2 โ— (swap! x + 10) โ— @x ;=> 12 โ— (reset! x 1) โ— @x ;=> 1 โ— (def x (r/atom 1)) โ— (defn f [] (prn โ€œx = โ€œ @x)) โ— ; reagent mount f as component โ— (swap! x inc) ;>> โ€œx = 2โ€ ๋ณ€๊ฒฝํ•˜ ๋ฉด ์ž๋™์œผ๋กœ ํ˜ธ์ถœ๋œ๋‹ค
  • 26. re-frame Reagent component โ— ํ™”๋ฉด์„ ๊ตฌ์„ฑํ•œ๋‹ค๋Š” ๊ฒƒ์€ ๊ณง ๋ฐ์ดํƒ€๋ฅผ ๊ตฌ์„ฑํ•œ๋‹ค๋Š” ๊ฒƒ โ— ๋ฐ์ดํƒ€ ์กฐ์ž‘๋งŒ์œผ๋กœ ํ™”๋ฉด์„ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค! D V signal signal D signal Ratom
  • 28. re-frame Reagent component D V signal signal D signal Ratom Reagent component D V signal signal D signal Ratom 2 Ratom ์‚ฌ์ด์— ๊ด€๊ณ„๊ฐ€ ์—†๋‹ค.
  • 29. re-frame Reagent component D V signal signal D signal Ratom Reagent component D V signal signal D signal Ratom 2 Ratom ์‚ฌ์ด์— ๊ด€๊ณ„๊ฐ€ ์žˆ์–ด์•ผโ€ฆ ์ฆ‰ ํ•œ Ratom์˜ ๋ณ€ํ™”๊ฐ€ ๋‹ค๋ฅธ Ratom์— ์ „ํŒŒ๋˜์–ด์•ผ...
  • 30. re-frame Reagent component D V signal signal D signal Ratom Reagent component D V signal signal D signal Ratom ๊ทธ๋Ÿฌ๋‚˜ Ratom์—๋Š” ์ด๋Ÿฐ ๊ธฐ๋Šฅ์ด ์—†๋‹ค. โ•ณ
  • 31. re-frame Reagent component D V signal signal D signal Ratom Reagent component D V signal signal D signal Reaction Reaction์ด ๊ทธ ์—ญํ• ์„ ํ•  ์ˆ˜ ์žˆ๋‹ค. Reaction
  • 33. re-frame Reagent component D V signal signal D signal Ratom Reagent component D V signal signal D signal Reaction Data Flow Graph !!! Reaction
  • 35. re-frame Reagent component D V signal signalD signal Ratom Reagent component D V signal signal D signal Reaction Reaction์€ ๋‹ค์ˆ˜์˜ ์‹œ๊ทธ๋„์„ ๊ฒฐํ•ฉํ•ด์„œ ๊ณ„์‚ฐ์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ๋ฆฌํ„ดํ•  ์ˆ˜ ์žˆ๋‹ค. D signal Ratom Reaction ์˜ ์žฅ์  1
  • 37. re-frame Reagent component D V signal signal D signal Ratom Reagent component D V signal signal D signal Reaction Reaction ์˜ ์žฅ์  2 Reaction์€ ๊ด€์‹ฌ์žˆ๋Š” ๋ถ€๋ถ„์˜ ๋ณ€ํ™”๋งŒ ์ „ํŒŒํ•  ์ˆ˜ ์žˆ๋‹ค. part part
  • 39. re-frame D V D D VD ๋‹จ์ : Ratom, Reaction ์‹œ์Šคํ…œ์ด ์ปค์ง€๋ฉด ์œ„ ๊ทธ๋ฆผ์ฒ˜๋Ÿผ Graph๊ฐ€ ๋ณต์žกํ•ด์ง„๋‹ค. D V D D VD D V D D VD D V D D VD
  • 40. re-frame D V app-db Ratom D VD One Big Ratom app-db D V D VD
  • 41. re-frame app-db โ— โ€œWell-formed Data at rest is as close to perfection in programming as it gets.โ€ โ€” Fogus (@fogus) April 11, 2014 โ— in-memory database โ— OOP์™€๋Š” ๊ทน๋ช…ํ•˜๊ฒŒ ๋Œ€์น˜๋˜๋Š” ์ง€์  โ—‹ Local state is harmful. โ—‹ State considered harmful. โ—‹ Global์ด๋ƒ Local์ด๋ƒ๊ฐ€ ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ๋ผ, State๋ฅผ ์ตœ๋Œ€ํ•œ ์ค„์ด๊ณ  ์ž˜ ๋‹ค๋ฃจ๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•˜๋‹ค. โ— ์žฅ์  โ—‹ application state์˜ ๋™๊ธฐํ™”๊ฐ€ ์‰ฝ๋‹ค. โ—‹ Undo/Redo ๊ตฌํ˜„์ด ์‰ฝ๋‹ค. โ—‹ application ์„ FSM์œผ๋กœ ๋ชจ๋ธ๋งํ•  ์ˆ˜ ์žˆ๋‹ค. โ—
  • 42. re-frame app-db components Hiccup Reagent VDOM React DOM f1 f2 f3 unidirectional, dynamic, async, discrete FRP data flow
  • 43. re-frame app-db components Hiccup Reagent VDOM React DOM f1 f2 f3 Browser pixels Monitor photons f4 f5 unidirectional, dynamic, async, discrete FRP data flow continued...
  • 44. re-frame app-db components Hiccup Reagent VDOM React DOM f1 f2 f3 Browser pixels Monitor photons f4 f5 unidirectional, dynamic, async, discrete FRP data flow continued...
  • 46. re-frame Subscription โ— loosely coupling โ—‹ Component๋Š” app-db์— ๋Œ€ํ•ด ์ตœ์†Œํ•œ์˜ ์ •๋ณด๋งŒ ์•Œ์•„์•ผ ํ•œ๋‹ค. โ—‹ ์„ ์–ธ์  ๋ฐฉ์‹์œผ๋กœ reaction์„ ์š”์ฒญํ•œ๋‹ค. โ—‹ ํ•˜๋‚˜์˜ Component๋Š” ์กฐ๊ฑด์— ๋”ฐ๋ผ ๋‹ค๋ฅธ reaction์— ๊ด€๊ณ„. โ— pameteryzed query โ— app-db๋Š” ๋ฐ์ดํƒ€๋ฒ ์ด์Šค๋‹ค. โ— re-frame์˜ subscription์€ ์ด ์—ญํ• ์„ ์ˆ˜ํ–‰ํ•œ๋‹ค. โ— register-sub ํ•จ์ˆ˜ : ํ‚ค์›Œ๋“œ๋กœ Subscription ๋“ฑ๋ก โ— subscribe ํ•จ์ˆ˜ : ํ‚ค์›Œ๋“œ๋กœ ์ง€์ •๋œ reaction์„ ๋ฆฌํ„ดํ•œ๋‹ค.
  • 47. re-frame Subscription (register-sub :customer-query (fn [] [db [sid cid]] (reaction (get-in @db [:path :to :a :map cid]))) (subscribe [:customer-query]) UI ์ฝ”๋“œ์—์„œ ์‚ฌ์šฉ. UI ๊ด€์ ์—์„œ ํ•„์š”ํ•œ ์ •๋ณด๋ฅผ ์„ ์–ธ์ ์œผ๋กœ query๋ฅผ ์š”์ฒญ. app-db์— ๋Œ€ํ•œ ๊ตฌ์ฒด์ ์ธ ์ง€์‹์ด ํ•„์š”์—†๋‹ค. DB ์ฝ”๋“œ์— ์กด์žฌ. app-db์— ๋Œ€ํ•œ ์ง€์‹ ์ •๋ณด ํ•„์š”. ์š”์ฒญ๋œ query๋ฅผ ์ˆ˜ํ–‰ํ•œ ํ›„, reaction์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.
  • 49. re-frame app-db components Hiccup Reagent VDOM React DOM f1 f2 f3 Dispatch events eventhandler
  • 50.
  • 51. re-frame Dispatch events โ— events is data. โ— 2nd flow, reverse flow โ— mouse click, ajax โ— mutate app-db โ—‹ Component๋Š” app-db์— ๋Œ€ํ•ด ์ตœ์†Œํ•œ์˜ ์ •๋ณด๋งŒ ์•Œ์•„์•ผ ํ•œ๋‹ค. โ—‹ ์„ ์–ธ์  ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝ์„ ์š”์ฒญํ•œ๋‹ค. โ— register-handler ํ•จ์ˆ˜ : ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ ๋“ฑ๋ก. ํ•ธ๋“ค๋Ÿฌ ํ•จ์ˆ˜๋Š” app-db๋ฅผ ๋ณ€๊ฒฝ. โ— dispatch : ์ด๋ฒคํŠธ ๋ฐœ์ƒ โ— app-db๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๋ชจ๋“  ์ฝ”๋“œ๋Š” ํ•ธ๋“ค๋Ÿฌ ํ•จ์ˆ˜๋“ค ์•ˆ์— ์กด์žฌํ•˜๊ฒŒ ๋œ๋‹ค. โ—‹ ๋”ฐ๋ผ์„œ ์–ด๋Š ์ง€์ ์—์„œ ์–ด๋–ค ๋ณ€๊ฒฝ์ด ์žˆ๋Š”์ง€๋ฅผ ์‰ฝ๊ฒŒ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
  • 52. re-frame Dispatch events (register-handler :delete-item (fn [app-db [hid item-id]] (dissoc-in app-db [:some :path item-id])) (dispatch [:delete-item 42]) UI ์ชฝ ์ฝ”๋“œ์— ์กด์žฌ. ๋ณ€๊ฒฝ ์š”์ฒญ์— ๋Œ€ํ•œ ์„ ์–ธ. ๊ตฌ์ฒด์ ์ธ ๊ตฌํ˜„๊ณผ๋Š” ๋ฌด๊ด€. DB ์ชฝ์— ์กด์žฌ app-db์— ๋Œ€ํ•œ ์ง€์‹์„ ์•ˆ๋‹ค. ๊ตฌ์ฒด์ ์ธ ๋ณ€๊ฒฝ์„ ์ˆ˜ํ–‰ํ•œ๋‹ค.