the history of reactive extensions

23
The History of Reactive Extensions How extended Rx across languages 2014/10/28 RxJava Night #rxjnight Yoshifumi Kawai - @neuecc

Upload: yoshifumi-kawai

Post on 18-Jun-2015

27.793 views

Category:

Technology


0 download

DESCRIPTION

RxJava Night 2014/10/28

TRANSCRIPT

Page 1: The History of Reactive Extensions

The History of Reactive ExtensionsHow extended Rx across languages

2014/10/28 RxJava Night #rxjnightYoshifumi Kawai - @neuecc

Page 2: The History of Reactive Extensions

Self Introduction

@仕事

株式会社グラニ取締役CTO

神獄のヴァルハラゲート, モンスターハンターロアオブカード

最先端C#によるハイパフォーマンスWebアプリケーション

@個人活動

Microsoft MVP for Visual C# / 野良C#エヴァンジェリスト

Web http://neue.cc/

Twitter @neuecc

Page 3: The History of Reactive Extensions

linq.js – LINQ for JavaScript

そろそろメンテしてあげたい。。。

Page 4: The History of Reactive Extensions

LINQ to BigQuery

最近はBigQueryにはまってLINQライブラリ作りなど

LINQ to BigQuery - C#による型付きDSLとLINQPadによるDumpと可視化

http://neue.cc/2014/09/24_479.html

https://github.com/neuecc/LINQ-to-BigQuery

Page 5: The History of Reactive Extensions

Rx and Me

Page 6: The History of Reactive Extensions

私とRx一番古い記事が

2009/09/04

http://neue.cc/category/programming/rxRx関連の記事が現在70 (思ってたより多かった!)

Page 7: The History of Reactive Extensions

入門連載

連載は2回で止まってる。連載逃げたとかかんとか……

2011/11/01で内容的には些か古い(基本原理とかは変わってないので必ずしも使えない記事というほ

どではないですが)

http://www.atmarkit.co.jp/fdotnet/introrx/introrx_01/introrx_01_01.html

> また、今回のお礼を個別にささやかではありますがお食事というかたちでさせていただければと思うのですが、いかがでしょうか。

Page 8: The History of Reactive Extensions

UniRx

https://github.com/neuecc/UniRx Unity用のReactive Extensions実装(.NET用のRxはUnityで動かないので自前で実装)

Page 9: The History of Reactive Extensions

ReactiveX

http://reactivex.io/ReactiveX公式サイトのLanguagesにラインナップ

されました(非公式Rxでは初)

Page 10: The History of Reactive Extensions

Who is the creator of Rx?

Page 11: The History of Reactive Extensions

Erik Meijer@headinthebox

Page 12: The History of Reactive Extensions

御意見番。

Issue見てると大事な変更とか議論にはたいてい呼びかけられる

Page 13: The History of Reactive Extensions

Haskellとの関わり

Haskell 98策定者の一人

Programming in Haskellの動画解説とかも

http://www.cs.nott.ac.uk/~gmh/book.html

Parsec: A practical parser library

Daan Leijen, Erik Meijer

http://research.microsoft.com/en-us/um/people/emeijer/papers/parsec.pdf

Page 14: The History of Reactive Extensions

@Microsoft Research

Cω(しーおめが) – C#ベースの実験言語

http://research.microsoft.com/en-us/um/cambridge/projects/comega/

2004年にコンパイラプレビュー公開

続報はない、というのもC# 3.0(LINQ) - 2008に吸収された

というわけでFather of LINQ

でもある

Page 15: The History of Reactive Extensions

@Microsoft

Microsoft Live Labs Volta

盛大にコケた

アイコンだけ生き残った(Volta => 電気うなぎ)

Reactive Extensions

2009に実験ライブラリとして公開→かなり普及する(ただし標準

ライブラリ化はならず)→OSS化→他言語への波及

FRP自体はRx以前からあったけど、実験に留まらず粘り強く実用

レベルに落としこんでいったのは感嘆するな仕事だと思ふ

Page 16: The History of Reactive Extensions

@Applied Duality

独立開業

Principles of Reactive Programming

https://www.coursera.org/course/reactive

(Martin Odersky, Erik Meijer, Roland Kuhn) –当然Scalaで。

Facebookの型付きPHPみたいな何か新言語

C#スタイルなNullableやGenericsやAsyncなどから貢献が伺える

Microsoftに囚われず自由にやってるようでいいことですね!

Page 17: The History of Reactive Extensions

その他の人々Jafer Husain

最初のRx紹介者(MicorsoftでSilverlightの仕事で初期プロトタイプのRxを使った)

http://themechanicalbride.blogspot.jp/2009/07/introducing-rx-linq-to-events.html

その後Netflixに転職し、 RxJavaを作成

(つまり言語を超えた普及に最も貢献したのはこの人ではないのだろうか!?)

Mattew Podwysocki

MSの人。地道にずっとRxJS頑張ってる:)

Bart de Smet

Rx 2.0の大半を作成、.NETの超絶エキスパート

現在はWindows Phone 8に搭載されたCortanaをRx使って構築

http://channel9.msdn.com/events/TechDays/Techdays-2014-the-Netherlands/Event-processing-at-all-

scales-with-Reactive-Extensions

2014年4月のこの動画はRx入門の決定版とでもいうべき内容

Page 18: The History of Reactive Extensions

LINQ – Rx

Page 19: The History of Reactive Extensions

LINQ #とは

.NETにおいて、RxはまずLINQがあった

LINQ(to Objects)とは……Streamを処理する何か

Where = fIlter, Select = map、文法的にはSQLだけど中身的には

今や当たり前にどこかで聞いたことあるアレソレ

(当時は革新的だった!実用的な意味では今も現役に便利!)

var query = source.Where(x => x % 2 == 0).Select(x => x * x);

Page 20: The History of Reactive Extensions

Pull(Interactive) vs Push(Reactive)

DataSource

(IEnumerable<T>)

Action

値の要求(Pull)

DataSource

(IObservable<T>)

Action

値の送信(Push)

Page 21: The History of Reactive Extensions

時間軸を基盤にしたLINQイベントを時間軸に乗った無限リストとみなす

それによりシーケンスと「同じように」書ける(map, filter, etc...)

Pushスタイル、IObservable<T>IEnumerable<T>はPullスタイル、その反対側にある

Reactive Extensions(Rx)

time

間隔は不定期でも可

終わりがなくてもいい(無限に続く)

Page 22: The History of Reactive Extensions

Conclusion

Page 23: The History of Reactive Extensions

Rx is not only C#

むしろ他言語のほうが流行ってるのでは感

RxJava, ReactiveCocoa, RxJS/Bacon.js, etc...

要因は幾つかある(Rxの威力のうち非同期の側面は言語統合の非同期構文(C# 5.0 async/await)が引き受けたから、たとえば非同期の待ち合わせはawait

Task.WhenAll()など、うちの会社のサーバーサイド実装でも多用してる)

とはいえ別に決して流行ってないわけではない、よ! #多分

not only LINQ?切り離してもいいけれど、理解の難易度的にはLINQ(Pull/Interactive)との関連性から結びだしたほうが捗るのではないかな?

別にLINQじゃなくても、自分のメイン言語のコレクション処理の構文と結びつけてみると馴染める、はずきっと