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
5k
持続可能なプロダクト開発のために - フロントエンドと新陳代謝の話 / 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
360
TSX First な Zero-Runtime SSG potato4d/dodai とその仕組み / owned static site generator #kyotojs
potato4d
1
2.2k
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.9k
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
4k
私たちはなぜ SPA で開発するのか / Why you choose SPA
potato4d
39
26k
Amplify Console 誕生以来本番運用しつづけてわかったこと #awswakaran_tokyo
potato4d
6
3.5k
Other Decks in Programming
See All in Programming
新卒から4年間、20年もののWebサービスと 向き合って学んだソフトウェア考古学
oguri
7
6.7k
小さく段階的リリースすることで深夜メンテを回避する
mkmk884
2
130
SQL Server ベクトル検索
odashinsuke
0
110
WordPress Playground for Developers
iambherulal
0
120
プログラミング教育のコスパの話
superkinoko
0
120
GDG Super.init(version=6) - From Where to Wear : 모바일 개발자가 워치에서 발견한 인사이트
haeti2
0
560
パスキーのすべて / 20250324 iddance Lesson.5
kuralab
0
120
Coding Experience Cpp vs Csharp - meetup app osaka@9
harukasao
0
110
PHPUnit 高速化テクニック / PHPUnit Speedup Techniques
pinkumohikan
1
1.2k
신입 안드로이드 개발자의 AI 스타트업 생존기 (+ Native C++ Code를 Android에서 사용해보기)
dygames
0
500
ステートソーシング型イベント駆動の視点で捉えるCQRS+ES
shinnosuke0522
1
320
Return of the Full-Stack Developer
simas
PRO
1
310
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
500
Java REST API Framework Comparison - PWX 2021
mraible
29
8.5k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.5k
Embracing the Ebb and Flow
colly
85
4.6k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
How to train your dragon (web standard)
notwaldorf
91
5.9k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.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 • ࣺ͍ͯ͢ͷܗͱ։ൃʹΤϯδχΞ͚ͩͰ࣮ݱෆՄ • ΠϚͱະདྷͷੜ࢈ੑʹͲΕ͚ͩΣΠτΛஔ͍͍ͯΔ͔ͷڞ༗ • ฒͼʹͦΕΒʹཧղͷ͋ΔνʔϜɾ৫ܗ͕ඞཁ • ϑϩϯτΤϯυಛʹଞͱେ͖͘ҧ͏ͨΊɺಛ༗ͷҙࣝײΛͭ •
શͯʹ͓͍ͯࠓճͷελΠϧͰྑ͍ͱ͍͏Θ͚Ͱͳ͍ • ۀՁͷ͋ΔطଘίʔυܟҙΛ͍ͭͭ͜Ε͔ΒΛߟ͑Δ
ϑϩϯτΤϯυʮࣺͯΔʯ࣌ɻ