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
持続可能なプロダクト開発のために - フロントエンドと新陳代謝の話 / Frontend p...
Search
potato4d(Takuma HANATANI)
November 25, 2018
Programming
15
4.9k
持続可能なプロダクト開発のために - フロントエンドと新陳代謝の話 / Frontend premised on making changes
2018/11/25 に HTML5 Conference 2018 ( #html5j ) にて行ったセッションのスライドです。
potato4d(Takuma HANATANI)
November 25, 2018
Tweet
Share
More Decks by potato4d(Takuma HANATANI)
See All by potato4d(Takuma HANATANI)
どうせキレイに書けない処理は逆にAIに書いてもらうほうが良い説 / #kyotojs 22
potato4d
3
330
TSX First な Zero-Runtime SSG potato4d/dodai とその仕組み / owned static site generator #kyotojs
potato4d
1
2.1k
Vue.js with TSX - From Vue 2.x to Vue 3 #v_tokyo11
potato4d
9
4.8k
終わりゆく Vue 2.x 時代の状態設計のアンサー - Vue 3 の Provider への期待 / The Last Architecture of the Vue 2.x
potato4d
25
6.8k
Web Worker を使ってブラウザ上でポケモンの画像を解析したい! / Pokemon recognition from screenshots in browser using web worker
potato4d
0
1.2k
Firebase & Google Cloud によるサーバーレス帳票管理 #FJUG / Serverless Architecture in Candy
potato4d
8
3.6k
NestJS meetup Tokyo Opening Talk / What is NestJS? #nestjs_meetup
potato4d
11
3.9k
私たちはなぜ SPA で開発するのか / Why you choose SPA
potato4d
39
26k
Amplify Console 誕生以来本番運用しつづけてわかったこと #awswakaran_tokyo
potato4d
6
3.4k
Other Decks in Programming
See All in Programming
Spatial Rendering for Apple Vision Pro
warrenm
0
110
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
CSC305 Lecture 26
javiergs
PRO
0
140
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
330
42 best practices for Symfony, a decade later
tucksaun
1
180
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
470
Beyond ORM
77web
5
700
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
talk-with-local-llm-with-web-streams-api
kbaba1001
0
180
MCP with Cloudflare Workers
yusukebe
2
220
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
It's Worth the Effort
3n
183
28k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Speed Design
sergeychernyshev
25
670
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Faster Mobile Websites
deanohume
305
30k
Scaling GitHub
holman
458
140k
Visualization
eitanlees
146
15k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
The Pragmatic Product Professional
lauravandoore
32
6.3k
Transcript
࣋ଓՄೳͳϓϩμΫτ։ൃͷͨΊʹ - ϑϩϯτΤϯυͱ৽ँͷ - 2018.11.25 #html5j HANATANI Takuma(@potato4d)
HANATANI Takuma (@potato4d) • Freelance as "ElevenBack" (2017.07 ~) /
LINE Corp (2018.12 ~) • Contribute to • Vue.js JP Docs (Core maintainer) / Nuxt.js JP Docs (maintainer) • Web Application Developer • — Vue.js, Nuxt.js, Node.js(with TypeScript), Serverless • — User Interface, Micro Interaction, Product Development
https://github.com/potato4d
Agenda 1. ͜ͷηογϣϯͰ͢͜ͱɾΰʔϧʹ͍ͭͯ 2. όοΫΤϯυΛަ͑ͨݱతͳΞʔΩςΫνϟͷΩʔϫʔυ 3. ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ 4. ϑϩϯτΤϯυΛʮ࡞Γม͑ͯΏ͘ʯํੑͰͷ՝ղܾ 5.
ϑϩϯτΤϯυΛʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ 6. Real world
Agenda 1. ͜ͷηογϣϯͰ͢͜ͱɾΰʔϧʹ͍ͭͯ 2. όοΫΤϯυΛަ͑ͨݱతͳΞʔΩςΫνϟͷΩʔϫʔυ 3. ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ 4. ϑϩϯτΤϯυΛʮ࡞Γม͑ͯΏ͘ʯํੑͰͷ՝ղܾ 5.
ϑϩϯτΤϯυΛʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ 6. Real world
͜ͷεϥΠυͷରऀʹ͍ͭͯ
͜ͷεϥΠυͷରऀʹ͍ͭͯ • Frontend Engineer (touch Backend) • ϑϩϯτΤϯυ։ൃΛத৺ͱ͍ͯ͠ͳ͕ΒɺଞͷྖҬͷ։ൃख๏ ͳͲͷ؍ଌػձ͕͋Γɺݱঢ়ͷϑϩϯτΤϯυ։ൃͷվળΛ୳ͬͯ ͍Δ͔ͨ
• Backend Engineer (touch Frontend) • όοΫΤϯυྖҬͷ։ൃ͔ΒϑϩϯτΤϯυؔΘΔΑ͏ʹͳͬ ͕ͨɺಛ༗ࣄʹ͍͓ͭͯΈͷ͔ͨ ͳͲʹ࣮ͷ͋ΔηογϣϯͱͳΔ͜ͱΛఆ
ࠓճͷ՝ײ
”ݱత” ͳϑϩϯτΤϯυʹ͓͍ͯ ”ݱ࣮త” ͳϝϯςφϏϦςΟͷ୲อ ∠ ࠓճͷ՝ײ
”ཧ” ͷϑϩϯτΤϯυͱ ”ݱ࣮త” ͳϑϩϯτΤϯυڥ ∠ ࠓճͷ՝ײ
ࠓͷΰʔϧʹ͍ͭͯ
”ߴͳϓϩμΫτ։ൃ” ͱ ”҆ఆͨ͠Ձͷఏڙ” ͷͨΊ ∠ ࠓͷΰʔϧʹ͍ͭͯ
”ߴͳ։ൃڥͷத” Ͱ ”ੜ࢈ੑΛ׆͔͠ଓ͚Δ” ͨΊ ∠ ࠓͷΰʔϧʹ͍ͭͯ
✘ ΈͷΞʔΩςΫνϟ ✘ ಛఆٕज़ಛԽͷͩ͜ΘΓ ✘ ։ൃऀΒཱ͖ͪ͠ډৼΔ͍ ը૾ Adobe Stock Ͱ
"religion" Ͱௐͨͷ ∠ ࠓͷΰʔϧʹ͍ͭͯ
Agenda 1. ͜ͷηογϣϯͰ͢͜ͱɾΰʔϧʹ͍ͭͯ 2. όοΫΤϯυΛަ͑ͨݱతͳΞʔΩςΫνϟͷΩʔϫʔυ 3. ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ 4. ϑϩϯτΤϯυΛʮ࡞Γม͑ͯΏ͘ʯํੑͰͷ՝ղܾ 5.
ϑϩϯτΤϯυΛʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ 6. Real world
ݱతͳΞʔΩςΫνϟͷΩʔϫʔυ Monolithic Web Application
ݱతͳΞʔΩςΫνϟͷΩʔϫʔυ Monolithic Web Application
ݱతͳΞʔΩςΫνϟͷΩʔϫʔυ Single Page Application API-based Backend External Services
SPA ͷΩʔϫʔυ • React, Vue, Angular ͳͲͷϑϨʔϜϫʔΫʹΑΔ ”ίϯϙʔωϯ τࢦ” ͷߏஙγεςϜ͕ଓ͍͓ͯΓɺಛʹมԽͳ͍
• ʮঢ়ଶʯͷऔΓѻ͍Λ࠷େͷςʔϚͱ͓ͯ͠Γɺ࠷େྗͱͯ͠ Flux / Redux ͷ Ұۃूதͷঢ়ଶཧ ͕ϝδϟʔͱͳ͍ͬͯΔ • ”Single source of truth” ͔Βੜ·Εͨղऍ • ”Domain” ͱ "Presentation" ྆ํͷ ”Flux / Redux ͷґଘ” ∠ ݱతͳΞʔΩςΫνϟͷΩʔϫʔυ
API-based Backend ͷΩʔϫʔυ • ݹయతͳ MVC ཁૉ݈ࡏ (ੈքతʹ Laravel ͕
Ruby on Rails ͷγΣΞΛ্ճΔͳͲɺ Framework ͷมԽ͋Δ) • େنίʔυϕʔεͷӡ༻ʹ͓͍ͯ Clean Architecture ͳͲ ͷઃܭࢥऔΓೖΕΒΕ͓ͯΓɺίʔυΛੜ͖ͤ͞Δ͜ͱ ͷؔ৺͕ڧ͍ • ҰํͰ Micro Services ͷΑ͏ͳɺখ͞ͳαʔϏεͷू߹ʹΑͬ ͯҰͭͷେ͖ͳ՝Λ͢Α͏ͳ։ൃྗΛ૿େͤͭͭ͋͞Δ ∠ ݱతͳΞʔΩςΫνϟͷΩʔϫʔυ
ͦͷଞͷ৽ͨͳྲྀΕ • 2ͭͷ Serverless ͷීٴ • ߴՄ༻ੑͰεέʔϥϒϧͳόοΫΤϯυ։ൃͷੈք (FaaS) • Web
/ Mobile App ʹର͢ΔόοΫΤϯυఏڙͷੈք (BaaS) • ͳͲ͕͋Δ͕ɺࠓ SKIP ∠ ݱతͳΞʔΩςΫνϟͷΩʔϫʔυ
Agenda 1. ͜ͷηογϣϯͰ͢͜ͱɾΰʔϧʹ͍ͭͯ 2. όοΫΤϯυΛަ͑ͨݱతͳΞʔΩςΫνϟͷΩʔϫʔυ 3. ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ 4. ϑϩϯτΤϯυΛʮ࡞Γม͑ͯΏ͘ʯํੑͰͷ՝ղܾ 5.
ϑϩϯτΤϯυΛʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ 6. Real world
SPA ͷΩʔϫʔυ(͓͞Β͍) • React, Vue, Angular ͳͲͷϑϨʔϜϫʔΫʹΑΔ ”ίϯϙʔωϯ τࢦ” ͷߏஙγεςϜ͕ଓ͍͓ͯΓɺಛʹมԽͳ͍
• ʮঢ়ଶʯͷऔΓѻ͍Λ࠷େͷςʔϚͱ͓ͯ͠Γɺ࠷େྗͱͯ͠ Flux / Redux ͷ Ұۃूதͷঢ়ଶཧ ͕ϝδϟʔͱͳ͍ͬͯΔ • ”Single source of truth” ͔Βੜ·Εͨղऍ • ”Domain” ͱ "Presentation" ྆ํͷ ”Flux / Redux ͷґଘ” ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
ϑϩϯτΤϯυʹ͓͚Δ՝ͷ αϯϓϧέʔε ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
1. σβΠϯ&όοΫΤϯυͷ มߋैੑͷܽམ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
σβΠϯ & όοΫΤϯυཁҼ • ཁAʮ͜Ε·ͰϢʔβʔ͕Λ͍͚࣋ͬͯͨΕͲɺϢʔ βʔ͕ΧʔτΛ࣋ͪɺͦͷதʹΛ࣋ͭߏʹ API Λม͑ͨɻ ैͯ͠ཉ͍͠ɻʯ ∠
ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ ∠ σβΠϯɾόοΫΤϯυͷมߋैੑͷܽམ
σβΠϯ & όοΫΤϯυཁҼ • ཁAʮ͜Ε·ͰϢʔβʔ͕Λ͍͚࣋ͬͯͨΕͲɺϢʔ βʔ͕ΧʔτΛ࣋ͪɺͦͷதʹΛ࣋ͭߏʹ API Λม͑ͨɻ ैͯ͠ཉ͍͠ɻʯ •
ཁBʮσβΠϯ؍Ͱ UI ্͜Ε·Ͱ௨ΓϢʔβʔ͕ͱ ͍ͯͬͯͯ͠ɺҰཡͰऔΓѻ͑ΔΑ͏ͳͭ͘Γʹͯ͠ཉ͍͠ʯ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ ∠ σβΠϯɾόοΫΤϯυͷมߋैੑͷܽམ
σβΠϯ & όοΫΤϯυཁҼ • ཁAʮ͜Ε·ͰϢʔβʔ͕Λ͍͚࣋ͬͯͨΕͲɺϢʔ βʔ͕ΧʔτΛ࣋ͪɺͦͷதʹΛ࣋ͭߏʹ API Λม͑ͨɻ ैͯ͠ཉ͍͠ɻʯ •
ཁBʮσβΠϯ؍Ͱ UI ্͜Ε·Ͱ௨ΓϢʔβʔ͕ͱ ͍ͯͬͯͯ͠ɺҰཡͰऔΓѻ͑ΔΑ͏ͳͭ͘Γʹͯ͠ཉ͍͠ʯ ▶ɹ దʹϞδϡʔϧׂ͞ΕͨΦϒδΣΫτಉ࢜Λແཧཧͭͳ͗߹Θ ɹɹͤͯϑϩϯτΤϯυ༻ͷҰͭͷσʔλΛ࡞Γ্͛Δɺطଘͷ֓೦ͷҠ ɹɹߦͰେͳ૿ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ ∠ σβΠϯɾόοΫΤϯυͷมߋैੑͷܽམ
2. ઓज़తϥΠϒϥϦͷԽ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
ઓज़తϥΠϒϥϦͷԽ • ϥΠϒϥϦͷখ͞ͳ୯ҐͰτϨϯυมΘΔ • ܰྔͳ࣌ࠁૢ࡞Ͱਓؾͷ day.js 1 લʹͳ͔ͬͨ •
HTTP ϦΫΤετ superagent ফ͑ɺ axios Ͳ͏ͳΔ͔ • ։ൃͷͨΊͷϕʔεڥͩͬͯΑΓྑ͍ͷ͕Ͱͯ͘Δ • ܰྔόϯυϥͷ Parcel 1 લʹͳ͔ͬͨ • Vue.js ͷڧྗͳ։ൃࢧԉπʔϧͷ Vue CLI v3 1 લʹͳ ͔ͬͨ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
ઓज़తϥΠϒϥϦͷԽ • ಛʹҠߦ͠ͳͯ͘ੜ͖͍ͯ͘͜ͱͰ͖Δ • ͱ͍͑ϝδϟʔಀ͢ͱޙ͕௧͍ɻಛʹෳࡶͳϥΠϒϥϦ͕υ Ωϡϝϯτ͕ࡶͳ߹ʹ௧͍ • ઓུʹӨڹ͢ΔϥΠϒϥϦ͚ͩؾ߹Λ͍࣋ͬͯͬͯΔ߹͕ େ •
ཚΛݺΜͩ React v16 Ͱ͢Β·ͩ 1 લ • ࣮ Vue.js 1.0 ·ͩ 3 લɺ Vue.js 2.0 Ͱ 2 લɻ Vue.js 2.5 ͰҰલ……ɻ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
3. ϓϩάϥϚͱΞʔΩςΫτ ͦΕͧΕͷྖҬͷ༥߹ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
ϓϩάϥϚʹΑΔΞʔΩςΫνϟഁյ 1. ઃܭɾ։ൃऀʹΑͬͯ࡞ΒΕ͍ͯͨ React / Redux ʹΑΔ Single State Tree
ͷϏδωεϩδοΫ 2. ػೳվमͷͨΊʹৗʹ Redux ʹ࡞ΒΕͨ Architecture ͷ্Ͱ ߦ͏ඞཁ͕͋Δ 3. ͱ͋Δ࣮ऀʹΑͬͯ࡞ΒΕͨςελϏϦςΟΛܽ͘ίʔυີ ݁߹ͳՃϩδοΫͷ࣮͕ग़ݱ 4. ▶ ͙͢ʹϚʔδ͢ΔΘ͚ʹ͍͔ͣɺͱ͍͑ೖΕͳ͍߹ͷ։ ൃͷϩε௧͘ɺ௧ΈΛ͏τϨʔυΦϑΛڧཁ͞ΕΔ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ ∠ ϓϩάϥϚͱΞʔΩςΫτͦΕͧΕͷྖҬͷ༥߹
૯ͯ͡ͷ՝ͱͯ͠ͷ ҋͷຐज़ʹର͢ΔӴज़ ͷෆ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
ٻΊΒΕΔೋͭͷબࢶ 1. ʮ࡞Γม͍͑͢ʯઃܭΛΈ্͛Δ • ʹष͍ͷʹϑλΛͰ͖Δઃܭʹͯ͠͠·͏ • ࡞ۀऀʹΑΔ࣭ͳίʔυͷൃੜͳͲʹڧ͍ • ϓϩάϥϚͱͯ͠ʮෛ͚ʯͱײ͡ΔՕॴग़ͯ͘Δ 2.
ʮ࡞Γม͑Δඞཁ͕ۃྗͳ͍ʯઃܭΛΈ্͛Δ • ٕज़ਫ४͕ߴ͍͔ͭ҆ఆͨ͠࡞ۀڥͷ্ͰϫʔΫ͢Δ • ಥવͷ֎తཁҼͳͲͷੑ͕͋·Γڧ͘ͳΒͳ͍ʢ٫ͬͯͱͳΔ߹ʣ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
ٻΊΒΕΔೋͭͷબࢶ 1. ʮ࡞Γม͍͑͢ʯઃܭΛΈ্͛Δ • ʹष͍ͷʹϑλΛͰ͖Δઃܭʹͯ͠͠·͏ • ࡞ۀऀʹΑΔ࣭ͳίʔυͷൃੜͳͲʹڧ͍ • ϓϩάϥϚͱͯ͠ʮෛ͚ʯͱײ͡ΔՕॴग़ͯ͘Δ 2.
ʮ࡞Γม͑Δඞཁ͕ۃྗͳ͍ʯઃܭΛΈ্͛Δ • ٕज़ਫ४͕ߴ͍͔ͭ҆ఆͨ͠࡞ۀڥͷ্ͰϫʔΫ͢Δ • ಥવͷ֎తཁҼͳͲͷੑ͕͋·Γڧ͘ͳΒͳ͍ʢ٫ͬͯͱͳΔ߹ʣ ∠ ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝
Agenda 1. ͜ͷηογϣϯͰ͢͜ͱɾΰʔϧʹ͍ͭͯ 2. όοΫΤϯυΛަ͑ͨݱతͳΞʔΩςΫνϟͷΩʔϫʔυ 3. ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ 4. ϑϩϯτΤϯυΛʮ࡞Γม͑ͯΏ͘ʯํੑͰͷ՝ղܾ 5.
ϑϩϯτΤϯυΛʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ 6. Real world
ݦࡏԽ͍ͯ͠Δ • UI ͷੈքͱػೳͷੈքΛ͏·͘Θ͚ΒΕ͍ͯͳͯ͘σβΠϯै ͕ͯͭ͘͠Β͍ • Flux ҰຊͷΞʔΩςΫνϟʹΑͬͯԼखͳίʔυ͕ੜ·Εͨ࣌ͷ ϦΧόʔ͕ͯͭ͘͠Β͍ •
ϥΠϒϥϦͷै͕͘͠ͳ͍͕ vuln Λߟ͑ΔͱඞཁͰ͋ Γɺ໘ͰͭΒ͍ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ͷΨϯΛ୳Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ݦࡏԽ͍ͯ͠Δ • UI ͷੈքͱػೳͷੈքΛ͏·͘Θ͚ΒΕ͍ͯͳͯ͘σβΠϯै ͕ͯͭ͘͠Β͍ • Flux ҰຊͷΞʔΩςΫνϟʹΑͬͯԼखͳίʔυ͕ੜ·Εͨ࣌ͷ ϦΧόʔ͕ͯͭ͘͠Β͍ •
ϥΠϒϥϦͷै͕͘͠ͳ͍͕ vuln Λߟ͑ΔͱඞཁͰ͋ Γɺ໘ͰͭΒ͍ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ݦࡏԽ͍ͯ͠Δ • UI ͷੈքͱػೳͷੈքΛ͏·͘Θ͚ΒΕ͍ͯͳͯ͘σβΠϯै ͕ͯͭ͘͠Β͍ • Flux ҰຊͷΞʔΩςΫνϟʹΑͬͯԼखͳίʔυ͕ੜ·Εͨ࣌ͷ ϦΧόʔ͕ͯͭ͘͠Β͍ •
ϥΠϒϥϦͷै͕͘͠ͳ͍͕ vuln Λߟ͑ΔͱඞཁͰ͋ Γɺ໘ͰͭΒ͍ ྖҬΛ͚ͯࠩ͠ସ͑Մೳʹ͢Εղܾ͢Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ݦࡏԽ͍ͯ͠Δ • UI ͷੈքͱػೳͷੈքΛ͏·͘Θ͚ΒΕ͍ͯͳͯ͘σβΠϯै ͕ͯͭ͘͠Β͍ • Flux ҰຊͷΞʔΩςΫνϟʹΑͬͯԼखͳίʔυ͕ੜ·Εͨ࣌ͷ ϦΧόʔ͕ͯͭ͘͠Β͍ •
ϥΠϒϥϦͷै͕͘͠ͳ͍͕ vuln Λߟ͑ΔͱඞཁͰ͋ Γɺ໘ͰͭΒ͍ ྖҬΛ͚ͯࠩ͠ସ͑Մೳʹ͢Εղܾ͢Δ ߟ͑ํ͔Βม͑Δඞཁ͕͋ΓΫϦςΟΧϧ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ݦࡏԽ͍ͯ͠Δ • UI ͷੈքͱػೳͷੈքΛ͏·͘Θ͚ΒΕ͍ͯͳͯ͘σβΠϯै ͕ͯͭ͘͠Β͍ • Flux ҰຊͷΞʔΩςΫνϟʹΑͬͯԼखͳίʔυ͕ੜ·Εͨ࣌ͷ ϦΧόʔ͕ͯͭ͘͠Β͍ •
ϥΠϒϥϦͷै͕͘͠ͳ͍͕ vuln Λߟ͑ΔͱඞཁͰ͋ Γɺ໘ͰͭΒ͍ ྖҬΛ͚ͯࠩ͠ସ͑Մೳʹ͢Εղܾ͢Δ ߟ͑ํ͔Βม͑Δඞཁ͕͋ΓΫϦςΟΧϧ ྖҬΛ͚ͯࠩ͠ସ͑Մೳʹ͢Εղܾ͢Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ݦࡏԽ͍ͯ͠Δ • UI ͷੈքͱػೳͷੈքΛ͏·͘Θ͚ΒΕ͍ͯͳͯ͘σβΠϯै ͕ͯͭ͘͠Β͍ • Flux ҰຊͷΞʔΩςΫνϟʹΑͬͯԼखͳίʔυ͕ੜ·Εͨ࣌ ͷϦΧόʔ͕ͯͭ͘͠Β͍ •
ϥΠϒϥϦͷै͕͘͠ͳ͍͕ vuln Λߟ͑ΔͱඞཁͰ͋ Γɺ໘ͰͭΒ͍ ྖҬΛ͚ͯࠩ͠ସ͑Մೳʹ͢Εղܾ͢Δ ߟ͑ํ͔Βม͑Δඞཁ͕͋ΓΫϦςΟΧϧ ྖҬΛ͚ͯࠩ͠ସ͑Մೳʹ͢Εղܾ͢Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ΛݴޠԽͯ͠ ʮ͏গ͠ϚγͳΓํʯΛ୳͢ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ݱঢ়ͷ (͍ܰํ) • UI ύʔπͱػೳ͕ີ݁߹Ͱ͋ͬͨΓɺখ͞ͳύοέʔδʹৼΓճ ͞ΕΔ • ύοέʔδͷಛఆͷ༻్͚ͩͰ͋ΕɺͦͷػೳΛར༻͍ͯ͠ Δ͜ͱ͕Θ͔ΔΑ͏ʹͳ͍ͬͯΔ͖ •
ޙ͔Βೖͨ͠΄͏͕ྑ͍ఔͷ൚༻ੑΛٻΊΔͷΛͦͷ· ·ಡΈࠐΜͰ͍Δʹ͕͋Δ • = SOLID ݪଇʹର͢ΔҙࣝͷԼςελϒϧઃܭ DI ʹର ͢ΔҙࣝͷԼ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ݱঢ়ͷ (ॏ͍ํ) • Single source of truth ͷՁ؍͚ͩͰશͯΛ͓͏ͱ͢Δ • ୭͔ͷมߋ͕ΞϓϦέʔγϣϯશମʹӨڹ͔͚͠ͳ͍
• Local State ඞཁѱͱͳΔ͕ͣɺͦΕ͕ఆ͞Ε͍ͯͳ͍ • ݁Ռͱͯ͠ιʔείʔυͷӨڹൣғ͕େ͖͘ͳΔ • = ؔ৺ͷׂ౷࣏ͷߟ͑ํ͕ਁಁ͍ͯ͠ͳ͍ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ଞΛࢀߟʹͭ͘Γม͑Δख๏Λߟ͑Δ ΨϥύΰεԽͨ͠ϑϩϯτΤϯυ͔ΒઢΛҾ͖ɺόοΫΤϯυ Micro services จ຺ΛࢀߟʹɺҎԼΛॏཁࢦඪͱͯ͠ҙ͍ࣝͯ͘͠ • ʮׂ౷࣏ʯͷపఈ • ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ೝࣝ͢Δ •
ڞ௨ن֨ͱ༷ͷ੍ఆɾӡ༻ յΕʹ͘͘͢ΔΑΓഁغ͘͢͢͠Δ͜ͱʹओ؟Λஔ͘ख๏ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ଞΛࢀߟʹͭ͘Γม͑Δख๏Λߟ͑Δ • ʮׂ౷࣏ʯͷ֓೦Λίϯϙʔωϯτʹམͱ͠ࠐΜͰపఈ͢Δ • ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ೝࣝ͢Δ • ڞ௨ن֨ͱ༷ͷ੍ఆɾӡ༻ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ʮׂ౷࣏ʯͷపఈ 1. Flux / ReduxͷීٴʹΑͬͯੜ·ΕͨʮFluxͷංେԽʯΛݟ͢ • Flux / Redux άϩʔόϧมɾؔʹ͍ۙ͜ͱΛҙࣝ͠ɺ
νΣοΫϘοΫεͷҰͭʹ Redux Λ͏Α͏ͳ͜ͱ߇͑Δ • Flux / Redux རศੑͷ߹্υϝΠϯϞσϧͱඥ͕ͮ͘ଟ ͍͕ɺຊ࣭తʹ྆ऀʹؔͳ͍͜ͱΛҙࣝ͢Δ • ͱ͍͑ݱ࣮ղͱͯ͠ɺ Redux Ducks ύλʔϯ namespaced Vuex ͷߟ͑Λద༻͢Δ͜ͱͱ͠ɺੜ࢈ੑͱݟ௨͠ͷྑ͞ͷཱ྆ ΛਤΔ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ʮׂ౷࣏ʯͷపఈ 2. ϑϩϯτΤϯυʹ͓͚Δ ”υϝΠϯ” ʹਆܦ࣭ʹͳΓ͗͢ͳ͍ • ಘͯͯ͠ϑϩϯτΤϯυͷυϝΠϯ֓೦όοΫΤϯυͷͦΕ UI ߹ʹҾ͖ͣΒΕΔͷͱͳΔ •
ϑϩϯτΤϯυΛظతʹक͍ͬͯ͘߹ৗʹఆٛ͠ଓ͚ͯ ྑ͍͕ɺ ”ϑϩϯτΤϯυΛΞϓϦέʔγϣϯͷϓϨθϯςʔ γϣϯΛ୲͍ͯ͠ΔྖҬͷҰͭ" ͱͯܰ͘͠ଊ͑Δͱྑ͍ • ͱ͖ʹίϯϙʔωϯτͷػೳར༻ͯ͠ʮσʔλϞσϧʯͱ ʮDOMʯͷ௨৴ΛԁԽ͢Δ͜ͱʹ࠷దԽ͢Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ʮׂ౷࣏ʯͷపఈ 2. _ 3. Framework Component ͱ JavaScript ͷੈքͷڥքΛҙࣝ͢Δ •
Framework Component ͕ඞཁͰͳ͍ՕॴͰ Pure JavaScript ͷੈքʹࣄΛدͤΔ • Pure JavaScript ͷྖҬɺͦͷϞδϡʔϧγεςϜͷΓग़͠͞ Λ׆͔͠ɺੵۃతʹ SOLID ݪଇΛकΔΑ͏ͳίʔυͱ͍ͯ͘͠ • ରͯ͠ Framework Component ɺprops ͳͲͰ͞Εͨσʔλ Ϟσϧͷ੍ޚ͓ΑͼϧοΫΞϯυϑΟʔϧͷཧʹઐ೦͢Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ଞΛࢀߟʹͭ͘Γม͑Δख๏Λߟ͑Δ • ʮׂ౷࣏ʯͷ֓೦Λίϯϙʔωϯτʹམͱ͠ࠐΜͰపఈ͢Δ • ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ೝࣝ͢Δ • ڞ௨ن֨ͱ༷ͷ੍ఆɾӡ༻ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ೝࣝ͢Δ ࣍ͷࣄ࣮Λ౿·͑ͯɺϑϩϯτΤϯυΛ Micro services จ຺ʹ͓͚Δ αʔϏεͷେ͖͘ͳͬͨͷͰ͋Δͱղऍ͢Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ೝࣝ͢Δ ࣍ͷࣄ࣮Λ౿·͑ͯɺϑϩϯτΤϯυΛ Micro services จ຺ʹ͓͚Δ αʔϏεͷେ͖͘ͳͬͨͷͰ͋Δͱղऍ͢Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ Micro service
ͷݪஶ https://martinfowler.com/articles/microservices.html
ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ೝࣝ͢Δ ࣍ͷࣄ࣮Λ౿·͑ͯɺϑϩϯτΤϯυΛ Micro services จ຺ʹ͓͚Δ αʔϏεͷେ͖͘ͳͬͨͷͰ͋Δͱղऍ͢Δ 1. ಛఆͷ (User Interface)
1 ͭΛ࣋ͭΞϓϦέʔγϣϯશମ͔ ΒΈͨ߹ʹখ͞ͳҰͭͷϨΠϠͰ͋Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ Micro service ͷݪஶ https://martinfowler.com/articles/microservices.html
ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ೝࣝ͢Δ ࣍ͷࣄ࣮Λ౿·͑ͯɺϑϩϯτΤϯυΛ Micro services จ຺ʹ͓͚Δ αʔϏεͷେ͖͘ͳͬͨͷͰ͋Δͱղऍ͢Δ 1. ಛఆͷ (User Interface)
1 ͭΛ࣋ͭΞϓϦέʔγϣϯશମ͔ ΒΈͨ߹ʹখ͞ͳҰͭͷϨΠϠͰ͋Δ 2. ಠཱ͞ΕͨσϓϩΠϑϩʔͳͲΛཱ͓֬ͯ͠ΓɺΞϓϦέʔγϣ ϯશମ͔ΒΈͯಠཱతͳཧ͕Մೳͱͳ͍ͬͯΔ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ Micro service ͷݪஶ https://martinfowler.com/articles/microservices.html
ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ೝࣝ͢Δ ࣍ͷࣄ࣮Λ౿·͑ͯɺϑϩϯτΤϯυΛ Micro services จ຺ʹ͓͚Δ αʔϏεͷେ͖͘ͳͬͨͷͰ͋Δͱղऍ͢Δ 1. ಛఆͷ (User Interface)
1 ͭΛ࣋ͭΞϓϦέʔγϣϯશମ͔ ΒΈͨ߹ʹখ͞ͳҰͭͷϨΠϠͰ͋Δ 2. ಠཱ͞ΕͨσϓϩΠϑϩʔͳͲΛཱ͓֬ͯ͠ΓɺΞϓϦέʔγϣ ϯશମ͔ΒΈͯಠཱతͳཧ͕Մೳͱͳ͍ͬͯΔ 3. (ݪଇͰͳ͍͕) JSON ΛσϑΝΫτͱ͢Δ௨৴༷ͱඇRDBґ ଘͷཁૉΛ͓࣋ͬͯΓɺଞͷαʔϏεͱͷ௨৴Λલఏͱ͍ͯ͠Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ Micro service ͷݪஶ https://martinfowler.com/articles/microservices.html
αʔϏεͱͯ͠ೝࣝͨ͠߹ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ • ʮIn ରͯ͠దͳ Out ͕ઃఆ͞ΕΔʯ͜ͱ • User
Interface ͷૢ࡞ (In) ʹରͯ͠దͳ API Call ͱͦͷϨεϙ ϯε (Out) ͷϑΟʔυόοΫ͕ߦΘΕΔ͜ͱ • In / Out ͷσʔλߏ͕ಉ͡Ͱ͋Εɺ෦తͳίʔυ͕ഁغ͞Ε Α͏͕࡞Γม͑ΒΕΑ͏͕ଞͷϨΠϠʔʹӨڹ͕ͳ͍͜ͱ • ϒϥοΫϘοΫεͳՕॴʹ͍ͭͯݱ࣮తͳਫ४ͰϞϊʹΛᛉͬ ͯྑ͍͜ͱ ͕อূ͞Ε͍ͯΔͱଊ͑Δ͜ͱ͕Ͱ͖Δ Micro service ͷݪஶ https://martinfowler.com/articles/microservices.html
ଞΛࢀߟʹͭ͘Γม͑Δख๏Λߟ͑Δ • ʮׂ౷࣏ʯͷ֓೦Λίϯϙʔωϯτʹམͱ͠ࠐΜͰపఈ͢Δ • ϑϩϯτΤϯυΛͻͱͭͷαʔϏεͱͯ͠ͷೝࣝ͢Δ • ڞ௨ن֨ͱ༷ͷ੍ఆɾӡ༻ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
ڞ௨ن֨ͱ༷ͷ੍ఆɾӡ༻ • ϑϩϯτΤϯυόοΫΤϯυ(BFF/MVC)ͱଓ͢ΔҰͭͷϨΠ Ϡʔͱ͍͏લఏͷͱʹઃܭΛ͓͜ͳ͏ • όοΫΤϯυ༝དྷͷڞ௨༷௨৴ن֨ɾϑΥʔϚοτͷߟ͑Λ Web ϑϩϯτΤϯυʹద༻͍ͯ͘͠ • Open
API / Swagger • JSON Schema • gRPC (Not production ready) ← New! ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
༏Ґੑ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
༏Ґੑ - 1 • ʮϑϩϯτΤϯυʹ͋Γ͕ͪͳԽʯͷݪҼΛదʹִ͠ɺ มߋʹڧ͍ج൫Λங͘͜ͱ͕ՄೳͱͳΔ • ष͍ͷʹϑλΛ͍͢͠ڥ • ࣌ʹ߹Θͤͨ࠷৽ͷڥʹίετͰҠߦ͢Δ͜ͱ͕Ͱ͖Δ
• ࣭ͳίʔυ͕ࠞࡏͯ͠͠·͏γνϡΤʔγϣϯʹஔ͍ͯɺͦ ͷӨڹൣғΛ࠷খݶʹ͑Δ͜ͱ͕Ͱ͖Δ ʹ Redux ʹͯ͢ΛࡌͤΔΑ͏ͳઃܭͱൺֱ͠ɺ ɹ ѹతʹϝεΛ͍ΕΔ͖Օॴ͕গͳ͍ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
༏Ґੑ - 2 • ظతͳੜ࢈ੑͱظతͳੜ࢈ੑͷΣΠτௐ͕ԁ • ʮҰఆҎ্·Ͱͷ՝Λղܾ͢Δʹศར͕ͩͦΕҎ্ͱͳΔ ͱᐫͱͳΓ͍ٕ͢ज़ʯΛಋೖ͍͢͠ • όοΫΤϯυͰ͍͏ͱɺʮRuby
on Rails Λ͍ͬͯͯංେ Խͨ͠ΒࣺͯΒΕΔʯͱߟ͍͑ͯ͘ • ʮαʔϏεͱͯ͠ೝࣝ͢Δʯ߲Ͱड़ͨʮRDB ͷґଘ͔Βಀ ΕΒΕ͍ͯΔʯͱ͍͏ಛΛଘʹ׆͔͢ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
༏Ґੑ - 3 • ظతͳੜ࢈ੑͱظతͳੜ࢈ੑͷΣΠτௐ͕ԁ • ҎԼͷΑ͏ͳγνϡΤʔγϣϯͰίʔυ࣭ͷҡ͕͍࣋͠ ߹ʹɺ࣭ͳίʔυ͕ੜ·ΕΔ༨Λ࠷খݶʹ͑Δ • όοΫΤϯυ͔Βͷσʔλߏ͕ະఆٛ·ͨࡦఆதͰෆ໌
ྎͳঢ়ଶͰͷઃܭίʔσΟϯά • ֎తཁҼʹΑͬͯઃܭʹΛଟׂ͘͘͜ͱ͕Ͱ͖ͳ͍ঢ়گ ͰͷઃܭίʔσΟϯάͳͲ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
՝ײ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
՝ײ - 1 • Ҡߦ͢͠͞ͱطଘͷίʔυϕʔεͷྔʹෛͷ૬͕ؔ͋Δ • ৽ن෦ͷΈҰ෦͚ͩΛผΞʔΩςΫνϟʹͨ͠߹ʹࠞཚ ͕ੜ͡ΔՄೳੑ͕ߴ͍ • ϓϩδΣΫτϨϙδτϦɺ
package ୯ҐͰ͜ͷํʹஔ͖ ͍͑ͯ͘͜ͱ͕ඞཁͱͳΔ • ٯʹݴ͑৽͘͠ϨϙδτϦΛੜ͢Α͏ͳ࡞ۀ͕͋Ε͙͢ ʹऔΓೖΕ͍ͯ͘͜ͱ͕Ͱ͖Δ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
՝ײ - 2 • ”ʰແཧ͕ޮ͘ʱ͜ͱอݥͰ͋ͬͯؾܰʹߦͬͯྑ͍ಈػʹͳΒͳ ͍” ͱ͍͏จԽͷৢίετ • গ͠ͰະདྷΛࣺ͍ͯͯΔ͔͠Εͳ͍ͱ͍͏ҙࣝ •
ϓϩάϥϚ͙͠͞ͷਰୀ • ͋ΔҙຯͰ Web ϓϩάϥϛϯάʹ͓͍ͯૄ͔ʹͳ͍ͬͯͨ (UNIXֶͷΑ͏ͳ)ϓϩάϥϜͷجຊݪଇΛऔΓͨ͠ͱऔΕΔ • ҰํͰ௨ৗͷ Web ϓϩάϥϛϯάΒ͍͠େنͷҙࣝײམͪΔ ͨΊɺࣗݾߠఆײϞνϕʔγϣϯཧ͕ඞཁ ∠ ʮ࡞Γม͑ͯΏ͘ʯղܾख๏ΛͱΔ
Agenda 1. ͜ͷηογϣϯͰ͢͜ͱɾΰʔϧʹ͍ͭͯ 2. όοΫΤϯυΛަ͑ͨݱతͳΞʔΩςΫνϟͷΩʔϫʔυ 3. ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ 4. ϑϩϯτΤϯυΛʮ࡞Γม͑ͯΏ͘ʯํੑͰͷ՝ղܾ 5.
ϑϩϯτΤϯυΛʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ 6. Real world
ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ • ʮ࡞Γม͑ΔʯϕʔεͰίʔυͷ݁߹Λམͱ͠ɺݱతͳΞʔ ΩςΫνϟʹ͚ۙͮͨ߹ɺҎԼͷΑ͏ͳઃܭՄೳʹݟ͑Δ
ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ • ʮ࡞Γม͑ΔʯϕʔεͰίʔυͷ݁߹Λམͱ͠ɺݱతͳΞʔ ΩςΫνϟʹ͚ۙͮͨ߹ɺҎԼͷΑ͏ͳઃܭՄೳʹݟ͑Δ 1. ྺ࢙ͷ͋Δ Backend ઌΛΏ͘ Mobile App
จ຺ͰΘΕͯ ͍Δ Clean Architecture ͷϑϩϯτΤϯυͷద༻ 2. Backend Ͱղܾͷख๏ͱͯ͠ਁಁͭͭ͋͠ΔυϝΠϯ ͷ੍ఆٴͼͦΕʹج͍ͮͨઃܭͱ։ൃ
ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ • ʮ࡞Γม͑ΔʯϕʔεͰίʔυͷ݁߹Λམͱ͠ɺݱతͳΞʔ ΩςΫνϟʹ͚ۙͮͨ߹ɺҎԼͷΑ͏ͳઃܭՄೳʹݟ͑Δ 1. ྺ࢙ͷ͋Δ Backend ઌΛΏ͘ Mobile App
จ຺ͰΘΕͯ ͍Δ Clean Architecture ͷϑϩϯτΤϯυͷద༻ 2. Backend Ͱղܾͷख๏ͱͯ͠ਁಁͭͭ͋͠ΔυϝΠϯ ͷ੍ఆٴͼͦΕʹج͍ͮͨઃܭͱ։ൃ յΕͮΒ͘͢Δ͜ͱͰࠜຊతʹΛੜͮ͡Β͘͢Δ
ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ • ʮ࡞Γม͑ΔʯϕʔεͰίʔυͷ݁߹Λམͱ͠ɺݱతͳΞʔ ΩςΫνϟʹ͚ۙͮͨ߹ɺҎԼͷΑ͏ͳઃܭՄೳʹݟ͑Δ 1. ྺ࢙ͷ͋Δ Backend ઌΛΏ͘ Mobile App
จ຺ͰΘΕͯ ͍Δ Clean Architecture ͷϑϩϯτΤϯυͷద༻ 2. Backend Ͱղܾͷख๏ͱͯ͠ਁಁͭͭ͋͠ΔυϝΠϯ ͷ੍ఆٴͼͦΕʹج͍ͮͨઃܭͱ։ൃ ϑϩϯτΤϯυʹෆద·ͨΦʔόʔΤϯδχΞϦϯάͱͳΓ͕ͪ
ϑϩϯτΤϯυʹ͓͚ΔυϝΠϯͱ • ϓϩδΣΫτʹΑͬͯऔΓѻ͍ํ͕ҧ͏͕ɺଟ͘ ”Flux / Redux ্ۭؒʹදݱ͞ΕͨϞδϡʔϧ” Λද͢ ∠ ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ
ϑϩϯτΤϯυʹ͓͚ΔυϝΠϯͱ • ϓϩδΣΫτʹΑͬͯऔΓѻ͍ํ͕ҧ͏͕ɺଟ͘ ”Flux / Redux ্ۭؒʹදݱ͞ΕͨϞδϡʔϧ” Λද͢ • ͕͜ͷυϝΠϯɺຊʹυϝΠϯͱݺΔ΄Ͳͷͷͳͷ͔
∠ ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ
ϑϩϯτΤϯυʹ͓͚ΔυϝΠϯͱ • ϓϩδΣΫτʹΑͬͯऔΓѻ͍ํ͕ҧ͏͕ɺଟ͘ ”Flux / Redux ্ۭؒʹදݱ͞ΕͨϞδϡʔϧ” Λද͢ • ͕͜ͷυϝΠϯɺຊʹυϝΠϯͱݺΔ΄Ͳͷͷͳͷ͔
• ϓϩάϥϚ͕ઃܭͨ͠ ίʔυ API ͱີ݁߹ ͳσʔλߏ ∠ ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ
ϑϩϯτΤϯυʹ͓͚ΔυϝΠϯͱ • ϓϩδΣΫτʹΑͬͯऔΓѻ͍ํ͕ҧ͏͕ɺଟ͘ ”Flux / Redux ্ۭؒʹදݱ͞ΕͨϞδϡʔϧ” Λද͢ • ͕͜ͷυϝΠϯɺຊʹυϝΠϯͱݺΔ΄Ͳͷͷͳͷ͔
• ϓϩάϥϚ͕ઃܭͨ͠ ίʔυ API ͱີ݁߹ ͳσʔλߏ • UI ཁ݅όοΫΤϯυଆͷ ”υϝΠϯ” ͷߟ͑ʹΑͬͯมΘΓ ͏Δ ∠ ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ
ϑϩϯτΤϯυʹ͓͚ΔυϝΠϯͱ • ϓϩδΣΫτʹΑͬͯऔΓѻ͍ํ͕ҧ͏͕ɺଟ͘ ”Flux / Redux ্ۭؒʹදݱ͞ΕͨϞδϡʔϧ” Λද͢ • ͕͜ͷυϝΠϯɺຊʹυϝΠϯͱݺΔ΄Ͳͷͷͳͷ͔
• ϓϩάϥϚ͕ઃܭͨ͠ ίʔυ API ͱີ݁߹ ͳσʔλߏ • UI ཁ݅όοΫΤϯυଆͷ ”υϝΠϯ” ͷߟ͑ʹΑͬͯมΘΓ ͏Δ ͱ͢Δʹऑ͗͢Δߏͱόϥϯεײ֮ ∠ ʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ
ੜ͖Δͷ൚༻ίʔυͱצ • ଟ͘ͷ߹ʹ͓͍ͯɺલड़ͷཧ༝ʹΑΓ strict ͳυϝΠϯ͍͠ ※ ࣮ફऀࣄ࣮͍ΔͨΊෆՄೳͳΘ͚Ͱͳ͍͕ɺίετ͕ߴ͍ • ՝ײͰ͋ΔʮσβΠϯͱόοΫΤϯυυϝΠϯͷ֓೦มߋʯͳ Ͳʹऑ͘ͳͬͯ͠·͏
• ։ൃαΠΫϧͷҧ͏όοΫΤϯυͱฒΈἧ͑Δඞཁ͕ੜ·ΕΔ • UIɾσʔλϞσϧɾϏδωεϩδοΫͷ 3 छ͕ࠞࡏ͢ΔྖҬʹͭ ͍ͯʮࣺͯ͢͞ʯΛॏࢹͨ͠΄͏͕ίετରޮՌʹ༏ΕΔ
ੜ͖Δͷ൚༻ίʔυͱצ • ʮϑϩϯτΤϯυͷίʔυશ͘Ҿ͖ܧ͛ͳ͍ͷ͔ʯͱ͍͏ͱͦ ͏Ͱͳ͍ • ׂ౷࣏ͷ࣌ʹಉ࣌ʹͨ͠ Framework Component ͔Β Γग़͞Εͨ
Pure JavaScript ͷίʔυͳͲଉ͕͍ • ୯ҰΛक͓ͬͯΓςελϒϧͰ͋Γ֎తཁҼ͔Βಠཱ͞ ΕͨίʔυɺϓϩδΣΫτݻ༗͚ͷ lodash ͷΑ͏ͳศར ϢʔςΟϦςΟίʔυ API ΫϥΠΞϯτͳͲ
ੜ͖Δͷ൚༻ίʔυͱצ • ϑϩϯτΤϯυʮࣝͱܦݧ(=φϨοδ)ʯΛҾ͖ܧ͗ɺʮࢿ ࢈ͱෛ࠴Λഁغ͢Δʯͱଊ͑Δ • લड़ͷ௨ΓϢʔςΟϦςΟίʔυ API ΫϥΠΞϯτɺ UI ද
ࣔΛศརʹ͢ΔΑ͏ͳػೳΔ • UI มߋͱΞϓϦέʔγϣϯͷ֓೦ͷݟ͕͠ೖͬͨ߹ίʔ υͷҎ্ΛϦϥΠτ͢Δ͜ͱଟ͋͘Δ • ͡Ί͔Βͦͷ৺࣋ͪͰ͍Δ΄͏͕Ժ͔ʹ։ൃ͕Ͱ͖Δ
Agenda 1. ͜ͷηογϣϯͰ͢͜ͱɾΰʔϧʹ͍ͭͯ 2. όοΫΤϯυΛަ͑ͨݱతͳΞʔΩςΫνϟͷΩʔϫʔυ 3. ݱͷ։ൃελΠϧͷϑϩϯτΤϯυʹ͓͚Δ՝ 4. ϑϩϯτΤϯυΛʮ࡞Γม͑ͯΏ͘ʯํੑͰͷ՝ղܾ 5.
ϑϩϯτΤϯυΛʮ͘क͍ͬͯ͘ʯະདྷͷࢥߟ 6. Real world
Real world • ࠓճͷΑ͏ͳΞʔΩςΫνϟΛࢼͯ͠ΈΔ߹ɺ Vue.js + Vuex ʹΑΔ։ൃΛମݧ͢Δ͜ͱΛਪ͢Δ •
Vuex ׂ౷࣏ʹରͯ͠ੵۃత • ͋Θͤͯ Vue.js ίϛϡχςΟׂ౷࣏ʹରͯ͠ੵۃత • Redux ʹ͍ͭͯ൱ఆ͍ͯ͠ͳ͍ • ҰํͰɺίϛϡχςΟͷҙࢤͱͯ͠ҰۃूதʹدΓ͕ͪ
ঢ়ଶͷҰ෦͕ͻͱͭͷίϯϙʔωϯτ͚ͩʹଐ͍ͯ͠Δ߹ɺͦΕΛϩʔΧϧͷঢ়ଶ ͱ͓ͯͯ͘͠͠ͱΑ͍Ͱ͠ΐ͏ɻ͋ͳͨɺτϨʔυΦϑΛߟ্ྀͨ͠Ͱɺ͋ͳͨͷ ΞϓϦͷ։ൃχʔζʹ߹ܾͬͨఆΛ͖͢Ͱ͢ɻ ެࣜυΩϡϝϯτຊޠ༁ΑΓൈਮ Vuex
2%P*IBWFUPQVUBMMNZTUBUFJOUP3FEVY 4IPVME*FWFSVTF3FBDUTTFU4UBUF "5IFSFJTOPlSJHIUzBOTXFSGPSUIJT ެࣜυΩϡϝϯτΑΓൈਮ Redux
ͦͷଞຊͷؔ࿈ࢿྉʹ͍ͭͯ • Vuex υΩϡϝϯτʹΑΔϩʔΧϧεςʔτͷݴٴ • https://vuex.vuejs.org/guide/state.html#components-can-still-have-local-state • Redux υΩϡϝϯτʹΑΔϩʔΧϧεςʔτͷݴٴ •
https://redux.js.org/faq/organizingstate#do-i-have-to-put-all-my-state-into-redux- should-i-ever-use-reacts-setstate • Vue.js Λར༻ͨ͠έʔεͷ۩ମతͳྫ (ొஃऀʹΑΔաڈͷࢿྉ) • https://speakerdeck.com/potato4d/how-to-make-a-robust-vue-dot-js-application
͓ΘΓʹ
Caution • ࣺ͍ͯ͢ͷܗͱ։ൃʹΤϯδχΞ͚ͩͰ࣮ݱෆՄ • ΠϚͱະདྷͷੜ࢈ੑʹͲΕ͚ͩΣΠτΛஔ͍͍ͯΔ͔ͷڞ༗ • ฒͼʹͦΕΒʹཧղͷ͋ΔνʔϜɾ৫ܗ͕ඞཁ • ϑϩϯτΤϯυಛʹଞͱେ͖͘ҧ͏ͨΊɺಛ༗ͷҙࣝײΛͭ •
શͯʹ͓͍ͯࠓճͷελΠϧͰྑ͍ͱ͍͏Θ͚Ͱͳ͍ • ۀՁͷ͋ΔطଘίʔυܟҙΛ͍ͭͭ͜Ε͔ΒΛߟ͑Δ
ϑϩϯτΤϯυʮࣺͯΔʯ࣌ɻ