際際滷

際際滷Share a Scribd company logo
?????????????? 
MVVM???????? 
2014/10/31 @taketin
???? 
?????????????????????????????? 
?????????????????????????ゎ?? 
??????????????????f?????????? 
?? 
????????????????????????ヰ??? 
??? 
?????????????
FRP (FunctionalReactiveProgramming)
FRP (Functional Reactive Programming) 
???????
FRP (Functional Reactive Programming) 
??????? 
???????????????????????? 
?
FRP ?? 
??????????????????????????????? 
?
FRP ?? 
??????????????????????????????? 
? 
??????????????????????????????? 
???????????????????????グ???
FRP ?? 
??????????????????????????????? 
? 
??????????????????????????????? 
???????????????????????グ??? 
?????????????? http://www.reactivemanifesto.org/ ??? 
?f?????????? FRP?1997?? ?Functional 
Reactive Animation http://conal.net/papers/icfp97/ ??????? 
?????
???????????????????????? 
???????
???????????????????????? 
??????? 
??FRP??? 
??????????????????????
???????????????????????? 
??????? 
??FRP??? 
?????????????????????? 
?FRP ??? 
???????????????
???????????????????????? 
??????? 
??FRP??? 
var a = 1; 
var b = a + 1; 
a = 10; 
console.log(b) // => 2
???????????????????????? 
??????? 
??FRP??? 
var a = 1; 
var b = a + 1; 
a = 10; 
console.log(b) // => 2 
?FRP??? 
var a = 1; 
var b = a + 1; 
a = 10; 
console.log(b) // => 11
???????????????????????? 
??????? 
??FRP??? 
var a = 1; 
var b = a + 1; 
a = 10; 
console.log(b) // => 2 
?FRP??? 
var a = 1; 
var b = a + 1; 
a = 10; 
console.log(b) // => 11 
FRP?????????????????? 
b = a + 1 ????????????
???????????????????????? 
??????? 
??FRP??? 
var a = 1; 
var b = a + 1; 
a = 10; 
console.log(b) // => 2 
?FRP??? 
var a = 1; 
var b = a + 1; 
a = 10; 
console.log(b) // => 11 
FRP?????????????????? 
b = a + 1 ???????????? 
Excel ? A1??? =B2+C3?????A1??????B2?C3???????? 
????????????????????
???????????????????????? 
??????? 
??FRP??? 
$("#select").change(function(val){ 
console.log(val.currentTarget.value); 
}); 
// selectbox で、 ^foo ̄ をxkした 
> foo 
// selectbox で、 ^bar ̄ をxkした 
> bar 
?FRP??? 
var select = $("#select").asEventStream("change"); 
select.onValue(function(val) { 
console.log(val.currentTarget.value) 
}); 
// selectbox で、 ^foo ̄ をチェックした 
> foo 
// selectbox で、 ^bar ̄ をチェックした 
> bar
???????????????????????? 
??????? 
??FRP??? 
$("#select").change(function(val){ 
console.log(val.currentTarget.value); 
}); 
?FRP??? 
var select = $("#select").asEventStream("change"); 
select.onValue(function(val) { 
console.log(val.currentTarget.value) 
}); 
??????????????????????????????????????グ??? 
??? 
?????????????????????????????????????????? 
???????????
???????????????????????? 
??????? 
??FRP??? 
$("#select").change(function(val){ 
console.log(val.currentTarget.value); 
}); 
?FRP??? 
var select = $("#select").asEventStream("change"); 
select.onValue(function(val) { 
console.log(val.currentTarget.value) 
}); 
?????????? ???f? 
??????????????????????????????????????グ??? 
??? 
?????????????????????????????????????????? 
???????????
??????????????????????????????? 
??????????????????????グ???
??????????????????????????????? 
??????????????????????グ??? 
?????f???? == ???????????
??????????????????????????????? 
??????????????????????グ??? 
?????f???? == ??????????? 
ex) textField : ?????????????? 
button : ?????? on, off ????
??????????????????????????????? 
??????????????????????グ??? 
?????f???? == ??????????? 
ex) textField : ?????????????? 
button : ?????? on, off ???? 
FRP ????????????????????? 
?????????????1?????????????????? 
??????f??????????????????
??????????????????????????????? 
??????????????????????グ??? 
?????
??????????????????????????????? 
??????????????????????グ??? 
????? 
ex) ??? : 1, 2, 3, 4 
???? : ??????????? -> 2, 4, 6, 8 
???? : 4 ??????? -> 4, 8
??????????????????????????????? 
??????????????????????グ??? 
????? 
ex) ??? : 1, 2, 3, 4 
???? : ??????????? -> 2, 4, 6, 8 
???? : 4 ??????? -> 4, 8 
???????????????????????
??????????????????????????????? 
??????????????????????グ??? 
????? 
ex) ??? : 1, 2, 3, 4 
???? : ???????2???? -> 2, 4, 6, 8 
N ???? : 4 ??????? -> 4, 8 
N ?????5 ?????? -> 6, 8 
??????????????????????? 
??????????????????????????
Reactive programming??... 
?????????????????ィ???????グ?? 
????????f???????
Reactive programming??... 
?????????????????ィ???????グ?? 
????????f??????? 
??????????????????????????? 
????????????????????????????
Reactive programming??... 
?????????????????ィ???????グ?? 
????????f??????? 
??????????????????????????? 
???????????????????????????? 
?MVVM ???????????????
MVVM (Model View ViewModel)
MVVM (Model View ViewModel) 
?2005??Microsoft ? WPF ? Silverlight ?? ?????? 
?? via: http://ja.wikipedia.org/wiki/Model_View_ViewModel 
??? GUI ????????????
MVVM (Model View ViewModel) 
?2005??Microsoft ? WPF ? Silverlight ?? ?????? 
?? via: http://ja.wikipedia.org/wiki/Model_View_ViewModel 
??? GUI ???????????? 
?View?ViewModel?????ViewModel?Model????? 
??????◎?? 
image: http://www.atmarkit.co.jp/fdotnet/chushin/greatblogentry_02/greatblogentry_02_01.html
MVVM (Model View ViewModel) 
?Model - ?????????? 
?View - UI?????UI????? 
?ViewModel - View?Model?????????View??????????? 
?????????????View????R???????????せ??View?? 
?????????????????????????????????
MVVM (Model View ViewModel) 
View?ViewModel???????????????????????????? 
????????????????????????????????????? 
??????????????????????????????????????? 
???????????????????????????????????????? 
??????????
MVVM (Model View ViewModel) 
?せ??? 
??f?? View?????? 
?????????????
MVVM (Model View ViewModel) 
ReactiveCocoa (Objective-C) 
?FRP??????????f?DSL? 
?GitHub????????????GitHub?Mac???????????? 
?????????????????????????????? VM ??????? 
?????????????ViewController ?? View ??????????? 
?? ViewController ? MVC ? C ??◎??MVVM ? V ??
MVVM (Model View ViewModel) 
ReactiveCocoa (Objective-C) 
???? 
?????グ?????????????????????
MVVM (Model View ViewModel) 
ReactiveCocoa (Objective-C) 
???? 
?????グ????????????????????? 
????? 
?グ??????? 
?DSL ? FRP ???????
MVVM (Model View ViewModel) 
ReactiveCocoa (Objective-C) 
??????????? 3?? Swift ??? 
Swift ????????? https://github.com/ReactKit/ReactKit ???? 
?????ヨ??????
FRP??????????? 
???????f?????????????????????? 
????? 
????
FRP??????????? 
???????f?????????????????????? 
????? 
???? 
????f?????????? 
???????????????????????????????????? 
???????◎?R??
FRP??????????? 
???????f?????????????????????? 
????? 
???? 
????f?????????? 
???????????????????????????????????? 
???????◎?R?? 
???????????????????????ゎ???????
Library 
FRP: Javascript 
?https://github.com/Reactive-Extensions/RxJS 
?https://github.com/baconjs/bacon.js 
?https://github.com/facebook/react 
MVVM: Javascript 
?https://github.com/knockout/knockout 
?https://github.com/jashkenas/backbone 
?https://github.com/angular/angular.js 
?https://github.com/ractivejs/ractive 
?https://github.com/yyx990803/vue
????? 
???ヂ????????????????????????? 
http://ninjinkun.hatenablog.com/entry/introrxja 
??????????????????せ?? 
http://d.hatena.ne.jp/pokarim/20101226 
????????????? 
http://r7kamura.hatenablog.com/entry/2014/08/21/113654 
?FRP?ヰ 
http://maoe.hatenadiary.jp/entry/2012/12/24/011414 
?Web????????????????????? 
http://www.ediplex.com/blog/?p=830 
?????? ReactiveCocoa ??? 
https://speakerdeck.com/ninjinkun/yuruyakanareactivecocoafalsedao-ru 
?MVVM for iOS 
https://speakerdeck.com/laiso/mvvm-for-ios 
?ReactiveCocoa?iOS??MVVM 
http://ios.caph.jp/articles/mvvm-using-reactivecocoa 
?AngularJS????????????????? 
http://zoetrope.hatenablog.jp/entry/2014/02/15/175040 
?Bacon.js?T??Functional reactive programming 
http://gan.hatenablog.jp/entry/2013/11/10/152720

More Related Content

リアクティフ?フ?ロク?ラミンク?と珂閣閣珂ハ?タ`ンについて