Slide 1

Slide 1 text

࣍ͷ10೥ͷҝʹElixirΛϋοΫ͢ Δ mizchi @Shibuya.ex #1

Slide 2

Slide 2 text

About ☞ ήʔϜձࣾ → ڭҭܥϕϯνϟʔ → Increments Inc(Qiita) ☞ JavaScript(Frontend/Node.js) / ͪΐͬͱRuby ☞ Kobito for Windows ϝΠϯ։ൃऀ ☞ ֶੜ࣌୅ʹҰਓͰMMOΈ͍ͨͳͷ࡞ͬͯͨ

Slide 3

Slide 3 text

@mizchiͷڵຯ ☞ WebSocket౳ͷϦΞϧλΠϜॲཧʹڵຯ ☞ Erlang/Elixir͋Μ·ΓษڧͰ͖ͯͳ͍ ☞ ٕज़తʹத਎͕͋Δ࿩͸͠ͳ͍(Ͱ͖ͳ͍)

Slide 4

Slide 4 text

ElixirͰҰൃ౰͍ͯͨ

Slide 5

Slide 5 text

Elixir͸Ͳ͏͍͏ݴޠ͔ ☞ จ๏͸RubyͰத਎͸Erlang ☞ ৄ͘͠͸@naoya͞Μ͕ޠͬͯ͘ΕΔ(ͨ)Ͱ͠ΐ͏

Slide 6

Slide 6 text

͸͡Ίʹ

Slide 7

Slide 7 text

ੜଘઓུ ☞ ڈ೥ɺͲ͏ʹ͔ͯ͠࢓ࣄͰReact.jsΛ࢖͍͔ͨͬͨ ☞ React঺հهࣄΛॻ͖·ͬͨ͘ ☞ ΈΜͳགྷΕʙʙʙ

Slide 8

Slide 8 text

੒ޭͨ͠

Slide 9

Slide 9 text

ࠓ೥ ☞ Elixir? ☞ ϦΞϧλΠϜ΢Σϒͳ؍఺͔ΒElixir / Phoenix ʹ͍ͭͯ - Qiita Λॻ͍ͨ ☞ ʮnaoya͞Μ, elixir·͍͍͢͡Αʂ΍Γ·͠ΐ͏Αʂʯͬͯݴ͍ ·ͬͨ͘ΒWeb+DbͰ࿈ࡌ࢝·ͬͨ

Slide 10

Slide 10 text

Ͱ΋·ͩϙςϯγϟϧʹ֬ূ͕ ͳ͍

Slide 11

Slide 11 text

ࠓ೔Զʹ֬ূΛ͘Ε!!

Slide 12

Slide 12 text

ࣗ෼ͱElixirͷग़ձ͍ ☞ ౰࣌ͷಉ྅ͷ@udzura ͞Μʹ༠ΘΕͯୈҰճshinjuku.ex ʹࢀ Ճ ☞ http://d.hatena.ne.jp/mizchi/20120312/1331566107 ☞ StrangeLoop2014(ήςϞϊݴޠͷࡇయ)ͰଘࡏΛࢥ͍ग़͢ ☞ "Elixir and the Internet of Things" by Doug Rohrer - YouTube ☞ ͳΜ͔1.0ग़ͯͨ ☞ Elixir v1.0 released - Elixir

Slide 13

Slide 13 text

੝Γ্͕ͬͯΔʁ ☞ HackerNewsํ໘Ͱݴٴ͕͍͢͝૿͑ͨ ☞ Ұൃ౰ͯͦ͏ͳؾ഑

Slide 14

Slide 14 text

ٱ͠ͿΓʹ৮ͬͯΈΔ ☞ γϯλοΫε͸(ද໘తʹ͸)͋Μ·ΓมΘͬͯͳ͍ ☞ ৽ଔ౰࣌Θ͔Βͳ͔ͬͨErlangͷϝϞϦϞσϧͷੌ͕͞ɺࠓ͸ Θ͔ΔΑ͏ʹͳͬͨ ☞ ੲͳ͔ͬͨmix͍͢͝ศར ☞ mix࠷ߴͰ͸

Slide 15

Slide 15 text

͜͜ͰϞμϯͳݴޠΛৼΓฦΔ ☞ ruby / rubygems ☞ node / npm ☞ rust / cargo

Slide 16

Slide 16 text

Package Manager Is First Priority? ☞ ྲྀߦͬͯΔLL = ඞͣྑ͍ϑΝʔετͷύοέʔδϚωʔδϟ͕ ͋Δ ☞ Elixir͸ύοέʔδϚωʔδϟ݉Ϗϧυπʔϧͷ׬੒౓Ͱάϯͱ ෑډԼ͖͛ͯͨ ☞ (ࠓ͔Βݴޠ࡞ͬͯҰൃ౰͍ͯͨਓ͸ύοέʔδϚωʔδϟ͔Β ࡞Δͱྑͦ͞͏)

Slide 17

Slide 17 text

ϦΞϧλΠϜ΢Σϒ ☞ HTTP2 ☞ WebSocket ☞ WebRTC

Slide 18

Slide 18 text

WebSocketΛͱΓ·͘ݱঢ়: Ұੲલ ☞ Socket.IOҰ୒ ☞ Socket.IOͷӢߦ͖͕ո͍࣌͠୅͕͋ͬͨ ☞ 1೥൒͙Β͍ϝϯς͞Εͳ͔ͬͨ ☞ nodeͷӡ༻໘౗ ☞ γϯάϧϧʔϓͷnodeͷରো֐ੑ͸ׂͱ࠷ѱͷ෦ྨ

Slide 19

Slide 19 text

WebSocketΛͱΓ·͘ݱঢ়: ࠷ۙ ☞ WebSocketରԠϒϥ΢β͕૿͑ͨ ☞ ϑΥʔϧόοΫͷॏཁ౓ͷݮগ ☞ PaaSʹΑΔఏڙ ☞ Pusher ☞ Firebase

Slide 20

Slide 20 text

PaaSΛ࢖ͬͨݱ࣮ ՝ۚϓϥϯͰ༻్੍͕ݶ͞ΕΔ

Slide 21

Slide 21 text

ୡ੒͍ͨ͠ ☞ ࣗલͰ௿ϨΠςϯγͰରো֐ੑ͕ߴ͍(Web)Socket αʔόʔͷ ߏங͕؆୯ʹͳͬͯ΄͍͠ ☞ ͍ͭͰʹ Rails ͱ͔΋౗͍ͨ͠

Slide 22

Slide 22 text

ະདྷ? ☞ Ruby: rails/activecable ☞ Elixir: Phoenix/Channel

Slide 23

Slide 23 text

ϞμϯͳWAFʹٻΊΒΕΔ΋ͷ

Slide 24

Slide 24 text

ϞμϯͳHTML/SPAͷ෩ை ☞ ΋͏ೝূͱJSON API͚ͩͰΑ͘Ͷʁ ☞ Ή͠Ζଞͷػೳ͸अຐ ☞ Google ͕ΫϩʔϧؤுΔ or ΤϯδχΞ͕SSRؤுΕ͹ΫϥΠΞ ϯτ/αʔόʔͰςϯϓϨʔτ୯ҰԽ͸Մೳ ☞ ςϯϓϨʔτʹ͍ͭͯγʔϜϨεͳ౷߹Λ੒͠਱͛Ε͹ ͘͢͝ ͔͍͍ͬ͜ ؾ͕͢Δ

Slide 25

Slide 25 text

react-phoenix ☞ Λͭ͘Ζ͏ͱͨ͠ ☞ react-railsͷίʔυಡΜͰଞͷ؀ڥͰ΋࣮ݱͰ͖ͦ͏ͱ͍͏͜ͱ ͕Θ͔ͬͨ ☞ WIP

Slide 26

Slide 26 text

ʮ͋ͱ͸ͭ͘Δ͚ͩʂʯ {:ok, vm} = :erlang_v8.start_vm(file:"node_modules/react/dist/react.min.js") {:ok, ret}:erlang_v8.eval vm, "React.renderToString(React.createElement('div', {})) # "
"}

Slide 27

Slide 27 text

Elixir΁ͷෆຬ ☞ 2015೥ʹ͍·͞Βܕ͕ͳ͍ݴޠΛֶͿͳΜͯײ ☞ ύλʔϯϚονͰ͋Δఔ౓ϨίʔυΛ໌ࣔͰ͖Δ ☞ dialyzer Λ࢖͏ / ref. ੩తܕνΣοΫπʔϧDialyzerΛElixir ͔Β࢖͏ - Qiita ☞ Ҿ਺͕ҧ͏ɺ౳ͷ͋Δఔ౓ࣗ໌ͳ΋ͷ͸࣮ߦલʹ஄͍ͯΔ

Slide 28

Slide 28 text

dializerͷྫ defmodule Simple do @type atom_list :: list(atom) @spec count_atoms(atom_list) :: non_neg_integer def count_atoms(list) do # ... end end

Slide 29

Slide 29 text

Elixirʹղܾͯ͠ཉ͍͠໰୊ ☞ ϦΞϧλΠϜ΢Σϒ͸௨৴ස౓͕ߴ͍ ☞ σουϙΠϯτΛ౿ΉՄೳੑ͕ߴ͍ => Let it crash ͨ͠͞ ☞ খ͞ͳύέοτɾϓϩηε͕େྔʹඈͼަ͏ ☞ GCηϯγςΟϒ => ErlangVMͰղܾ͍ͨ͠

Slide 30

Slide 30 text

ຊԻ ☞ ͭ·Βͳ͍ݴޠͰফ໣ͨ͘͠ͳ͍ ☞ ElixirΈ͍ͨͳ໘നػೳੵΜͩݴޠྲྀߦͬͯ͘Ε

Slide 31

Slide 31 text

ׂΓ੾Γ ☞ Erlang ͸ ݁ہ Network DSL ݴޠͱׂͯ͠Γ੾ͬͨํ͕ྑ͍(by @volutans) ☞ ಘҙͳ͜ͱ͸ѹ౗తʹಘҙ͕ͩͦΕҎ֎͸ผʹ… ☞ CPUϔϰΟͳϓϩάϥϜ͕ૣ͘ͳΔΘ͚Ͱ͸ͳ͍

Slide 32

Slide 32 text

(๻͕)ษڧʹͳͬͨࢿྉ node.js vs Erlang (ωλ) - kuenishi's blog

Slide 33

Slide 33 text

͓ΘΓ