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
今あえてDRY原則に向き合う
Search
Shinpei Maruyama
February 09, 2018
51
560k
今あえてDRY原則に向き合う
Shinpei Maruyama
February 09, 2018
Tweet
Share
More Decks by Shinpei Maruyama
See All by Shinpei Maruyama
過去や未来を扱うのは難しい? 過去と未来に立ち向かうための勘所
shinpeim
3
3.5k
設計ナイト2022 トランザクションスクリプト
shinpeim
11
3.4k
Ruby (off|with) the Rails
shinpeim
20
5k
綱渡りバッチ脱出大作戦
shinpeim
3
3.4k
Building native apps with scala.js
shinpeim
2
1.3k
Nekogata Drum Sequencer written in Scala.js
shinpeim
2
3.9k
複雑なJavaScriptアプリケーションに立ち向かうためのアーキテクチャ
shinpeim
36
15k
Using Scala.js with the JavaScript ecosystems
shinpeim
0
2.2k
Vue.jsで実現するMVVMパターン Fluxアーキテクチャとの距離
shinpeim
22
32k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
95
5.2k
Building Applications with DynamoDB
mza
91
6.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
160
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
The Cost Of JavaScript in 2023
addyosmani
45
7k
Code Reviewing Like a Champion
maltzj
520
39k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Being A Developer After 40
akosma
87
590k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Transcript
CZ͠Μ͍BLBೣܕԻػ ࠓ͋͑ͯ%3:ݪଇʹ ͖߹͏
BCPVUNF w ג ϝσΟϩϜ w ݈߁Λͬͱ৽͘͠ w 4DBMB w +BWB4DSJQU
w 1FSM w 3VCZ
BCPVUNF ͍Ζ͍Ζॻ͔͍͖ͤͯͨͩ·ͨ͠
ࠓͷ w %3:ݪଇΛݟͦ͏ w ৽͍͔͠ʁ w Թނ৽ͱ͍͏͜ͱͰͲ͏͔ͻͱͭ
ಋೖ
%3:ݪଇධΑ͘ͳ͍ w ͋ΔఔܦݧΛੵΜͩϓϩάϥϚ ʮ%3:ʹ͍͍ҹͳ͍ʯ͍͍ͬͯ ͕ͪ
Θ͔Δ
ຊʹ͋ͬͨා͍ w ʮVQEBUFͱJOTFSUɺҾ͕ಉ͡ ͳͷͰಉؔ͡ʹ·ͱΊ·ͨ͠ʂ %3:ݪଇͰ͢ʂʯ
ͩΜͩΜ%3:ʹ ରͯ͠υϥΠͳଶ ͱΔΑ͏ʹͳΓ͕ͪ
Ͱɺͦͦ %3:ݪଇͬͯͳʹʁ
%POU3FQFBU:PVSTFMG w ॏෳΑ͘ͳ͍͔Βॏෳഉআ͠Α ͏Ͷɺͱ͍͏ݪଇ w ϓϩάϥϜͷʮઃܭʯʹؔ͢Δݪଇ Ͱ͢Ͷ
Αͦ͞͏͡ΌΜ ͱ͜ΖͰʜ
%POU3FQFBU:PVSTFMG w ॏෳΑ͘ͳ͍͔Βॏෳഉআ͠Α ͏Ͷɺͱ͍͏ݪଇ w ϓϩάϥϜͷʮઃܭʯʹؔ͢Δݪଇ Ͱ͢Ͷ
ઃܭͬͯͳΜͳͷʁ ;Θͬͱͯ͠ͳ͍ʁ
ιϑτΣΞͷઃܭͬͯʁ w Λׂͯ͠ɺߏԽ͢Δ͜ͱʢཁ ग़యʣ
ͳΔ΄Ͳʂ ׂ͢Ε ͑͑Μͳʂ
✋
Ͳ͏ׂ͢Δ͔ w ͨͱ͑%#Λѻ͏γεςϜʹ͍ͭͯɺ Ͳ͏͍͏ઢͰׂ͢Δ͔ߟ͑ͯΈΑ͏ w ςʔϒϧຖʹׂʁ w $36%Ͱׂʁ w ͋Δ͍ผͷࢹͰׂʁ
w ͍ΖΜͳํ๏͕ߟ͑ΒΕΔ͕ɺͲΕ͕ے͕ྑ ͍ͱݴ͑ΔʁͦΕͳͥʁ
Έ͘ʹׂͯ͠ μϝ
ઃܭݪଇ͕༩͑ͯ͘ΕΔͷ w ےͷྑׂ͍ͱͲ͏͍͏ׂͳͷ ͔ʁΛߟ͑ΔͨΊͷࢦ
%3:ݪଇΛͬͯ Λׂ͢Δ ྫΛݟͯΈΔ
ྫ w ͨͱ͑ඒ༰Ӄͷ༧ཧγεςϜΛ ߟ͑Δ w ελοϑͱސ٬͕͍Δ w ελοϑސ٬ɺͱʹࢯ໊Λ࣋ ͭ w
ͲͬͪpSTU@OBNFඞਢ
ૉʹॻ͖Լ͠
%3:͡Όͳ͍ʂ
%3:ݪଇʹૉʹଇΔ w 1FSTPO͍ͬͯ͏ΫϥεΛ࡞ͬͯɺ TFU@pSTU@OBNFͦ͜ʹॻ͜͏ʂ w 4UBGG1FSTPOΛܧঝͯ͠ w $MJFOU1FSTPOΛܧঝ͠Α͏ʂ w ͬͨͶʂ%3:ͩʂ
%3:ݪଇ
ͬͨͶʂ
ຊʹʁ
͋Δ w ʮ͜ͷγεςϜɺෆศͳΜͰ͢Αʯ w ి༧ͷͱ໊͖ͬͯࣈ͔͠ਜ͔ͳ ͍͜ͱ͕ଟ͍Μ͚ͩͲɺͳΜ͔Լͷ ໊લඞਢೖྗͳΜ͢ΑͶ
͋Δ w ʮελοϑ໊ࣈඞਢɺԼͷ໊લ ҙͰ͍͍Ͱ͔͢ʯ w ʮ͍ɺͦΕࠔΔͳʙʯ
ख͔͚ؒͣͰ͖Δमਖ਼
͜ΕͰ͍͍ͷʁ w Ϋϥεʹʮڞ௨͡Όͳ͍ॲཧʯ͕ ॻ͔ΕͯΔ w ;ͨͭͷࢠΫϥεͷಈ͖ͷҧ͍ ΫϥεΛݟʹߦ͔ͳ͍ͱΘ͔Βͳ͍ w ذෳࡶͷ࢝·Γ
͜ΕͰ͍͍ͷʁ w ͬͱͪΌΜͱॻ͜͏ͱࢥͬͨΒ Ϋϥεʹॻ͍ͯͨॲཧΛࢠΫϥεଆ ʹҠͯ͠ɺͦ͏͢ΔͱΫϥ εඞཁͳ͘ͳͬͯʜʜ w େखज़ͱͳΔ
%3:ʹͨ݁͠Ռɺ Ή͠Ζෳࡶੑ͕ ૿ͯ͠ϝϯςφϏϦ ςΟԼͨ͠ʜ
ͳͥ͜Μͳ͜ͱʹʜ
%3:ݪଇ l͚ͩz Λߟ͍͑ͯΔ͍ͤ
ଞͷઃܭݪଇ ݟͯΈΑ͏
ڽूͱ݁߹
ڽूͱ݁߹ w ڽूߴ݁͘߹͘ w ؔ࿈ͷߴ͍ͷಉ͡෦ʹ·ͱΊΔ w ෦ಉ࢜ͷӨڹͳΔ͘খ͘͢͞Δ
ྫ
ڽू͕͍ྫ ؔ࿈͢ΔͷΛ όϥόϥόϥͬͱ ͍ͬͯ͡͠·͍ͬͯΔ
ڽूΛߴΊΔ ؔ࿈͢Δͷ ͻͱͭʹ·ͱΊΔ
݁߹͕ߴ͍ྫ 4UB⒎ͱ$MJFOU ຊདྷผͷͷͳͷʹ ॲཧ͕ͻͱͭͷͱ͜Ζʹ ॻ͔Εͯ͠·͍ͬͯΔ
݁߹ΛΊΔ w ͋ͱͰΓ·͢
୯Ұݪଇ
୯Ұݪଇ w ͋ΔΫϥε͕มߋ͞ΕΔཧ༝͕̎ͭ Ҏ্͍͚͋ͬͯͳ͍
ྫ
୯Ұݪଇʹ͢Δྫ ΫϥεΛมߋ͢Δཧ༝ɿ 4UB⒎ͷ༷มߋ $MJFOUͷ༷มߋ
୯Ұʹ͢Δ w ͋ͱͰΓ·͢
ղ์ดݪଇ
։์ดݪଇ w ֦ுʹରͯ͠։͍͍ͯΔ w ػೳՃ͢ΔࡍʹɺͱͱͷίʔυʹӨ ڹ͕ͳ͍Α͏ʹ͠Α͏ w मਖ਼ʹରͯ͠ด͍ͯ͡Δ w ෦Λमਖ਼ͨ͠ͱ͖ʹͦͷΫϥεʹґଘ͠
ͯΔΫϥεʹӨڹ͕ͳ͍Α͏ʹ͠ͳ͚Ε ͳΒͳ͍
ྫ
֦ுʹରͯ͠։͍͍ͯͳ͍ ߴҠಈϞʔυͷଞʹ ΧχϞʔυ͕Ճ͞ΕͨΒʁ
֦ுʹରͯ͠։͘ ΧχϞʔυ͕Ճ͞Εͯ ଞͷΫϥεΛॻ͖͑Δ ඞཁͳ͠
मਖ਼ʹରͯ͠։͍͍ͯͳ͍ ߴҠಈϞʔυΛमਖ਼͢Δͱ͖ ΧχϞʔυʹӨڹΛ ༩͔͑Ͷͳ͍
मਖ਼ʹରͯ͠ด͡Δ ߴϞʔυΛमਖ਼ͯ͠ ଞͷΫϥεʹӨڹΛ༩͑ͳ͍
Ҏ্Λҙࣝͯ͠ Λ࠶ݕ౼͢Δ
ͷݟ͠ w 4UBGG$MJFOUͲͪΒࢯ໊Λ ࣋ͭ w ಉ͡7BMJEBUJPOͰ͋Δ w ผʑʹॻ͘ͱ%3:͡Όͳ͍ͷͰͳ Μͱ͔͍ͨ͠
w %3:Ͱͳ͍ຊདྷͻͱͭͷΫϥ εϝιου͕୲͏͖͕ෳ ͷͱ͜ΖʹΒ·͔Εͯ͠·͍ͬͯ Δ w Λݟͯ͠ΈΔ͖
୯Ұݪଇʢ࠶ܝʣ w ͋ΔΫϥε͕มߋ͞ΕΔཧ༝͕̎ͭ Ҏ্͍͚͋ͬͯͳ͍ w ˠʮมΘΓͦ͏ͳͱ͜Ζʯ͕Ͳ͔͜ ΛΓɺ͔ͦ͜ΒʮׂʯΛݟग़ ͖͢
Ͳ͕͜มΘΓͦ͏ʁมΘΒͳͦ͏ʁ w ސ٬ελοϑͱ͍͏ͷ͕ଘࡏ͢ Δ͜ͱଟͦ͏ͦ͏มΘΒͳ͍ͩ Ζ͏ w ސ٬ࣗମͷ༷มߋ͋Γͦ͏ w ελοϑͷ༷มߋ͋Γͦ͏
Ͳ͕͜มΘΓͦ͏ʁมΘΒͳͦ͏ʁ w ʮۭന͔Ͳ͏͔ΛνΣοΫ͢Δʯͬ ͯඞཁੑมΘΒͣ͋Γͦ͏ w ۭനͱԿ͔ʁมΘΔ͔ʢεϖʔ εʁOJMʁվߦʁʣ
Ͳ͏ׂ͢Δ w ސ٬ w ސ٬ͷ༷มߋʹΑͬͯมΘΔ w ελοϑ w ελοϑͷ༷มߋʹΑͬͯมΘΔ w
ۭനνΣοΫ܅ w ۭനͱԿ͔ɺͱ͍͏༷ʹΑͬͯมΘΔ
ͬͯΈͨ
ҰҾ͍ͯ ઃܭݪଇΛຬͨͯ͠ ͍Δ͔ݟͯΈΔ
݁߹ڽू w ڞ௨ͷΫϥε͕ͳ͘ͳͬͯ$MJFOU ͱ4UBGGͷ݁߹͕͘ͳͬͨ w ۭനνΣοΫॲཧࣗମۭനνΣο Ϋ܅ʹΓग़͞Ε͓ͯΓɺڽू͕ ߴ·ͬͨ
୯Ұݪଇ w $MJFOU͕มߋ͞ΕΔཧ༝$MJFOUͷ༷͕ มΘͬͨͱ͖ w 4UBGG͕มߋ͞ΕΔཧ༝4UBGGͷ༷͕ มΘͬͨͱ͖ w &NQUZ7BMJEBUPS͕มߋ͞ΕΔཧ༝ ʮ&NQUZͷఆٛʯ͕มΘͬͨͱ͖
OJM &NQUZͱΈͳ͢ͱ͔ʣ
։์ดݪଇ w ͦΕͧΕ͕मਖ਼͞ΕͯͦΕͧΕʹ ରͯ͠ӨڹΛ༩͑ͳ͍ʢमਖ਼ʹରͯ͠ ด͍ͯ͡Δʣ w ৽͍͠WBMJEBUPSΛఆٛͯͦ͠Ε ͧΕʹӨڹΛ༩͑ͳ͍ʢ֦ுʹର͠ ͯ։͍͍ͯΔʣ
͋Δ w ʮ͜ͷγεςϜɺෆศͳΜͰ͢Αʯ w Ծ༧ͷͱ໊͖ͬͯࣈ͔͠ਜ͔ͳ͍ ͜ͱ͕ଟ͍Μ͚ͩͲɺͳΜ͔Լͷ໊ લඞਢೖྗͳΜ͢ΑͶ
͋Δ w ʮελοϑ໊ࣈඞਢɺԼͷ໊લ ҙͰ͍͍Ͱ͔͢ʯ w ʮ͍ɺͦΕࠔΔͳʙʯ
मਖ਼ͨ͠
͋Δ w ϑΥʔϜ͔Β͍͍Μ͚ͩͲɺ"1* ͔Βୟ͍ͨΒͳΜ͔Τϥʔग़ͯΔΜ ͚ͩͲ w ˠௐͨΒɺpSTU@OBNFʹۭจࣈ ྻ͡Όͳͯ͘OJM͕͖ͬͯ͏Δ͜ͱ ͕Θ͔ͬͨ
मਖ਼ͨ͠
΄͔ͷ ઃܭݪଇߟ͑ͯ ॻ͍ͨΒ อकੑ͕ߴ·ͬͨʂ
w ·ͩͪΐͬͱ%3:͡Όͳ͍ʁ w 3VCZͷϝλϓϩʙΈ͍ͨͳͭͰͳΜ ͱ͔Ͱ͖ͦ͏ w ͦͷࡍʮଞͷઃܭݪଇΛഁΒͳ͍ʯ͜ ͱʹؾΛ͚ͭͳ͕ΒΓ·͠ΐ͏ ·ͱΊͱ༨ஊ
·ͱΊͱ༨ஊ w %3:ѱ͍ͭ͡Όͳ͍ɻ%3:ʮ͚ͩʯ͠ ͔ߟ͑ͳ͍ͷ͕ѱ͍ w Λదʹׂ͢ΔͨΊʹɺʮͲ͕͜ม ΘΓͦ͏ͰͲ͕͜มΘΒͳͦ͏͔ʯΛΔ͜ ͱ͕େࣄ w ͦΕ͕Θ͔Βͳ͍͏͔ͪΒաʹઃܭ͢Δͷ
ѱख
w ܧঝΑΓҠৡΛ͑ͬͯʁʮͳ ͥʯʮͲ͏͍͏ͱ͖ʹʯͦ͏͖͔͢ ͱ͍͏Ͱ͢ w ʮͳΜͱͳ͘ηϯεͰ͍ͬͯͯͭ ࠔͬͯͳ͍͚ͲʯͦΕ͕Ͱ͖Δͻ ͱ͜Μͳൃදແࢹͯ͠େৎʂ ·ͱΊͱ༨ஊ
࠷ޙએ w Ұॹʹಇ͍ͯ͘ΕΔͻͱΛืूͯ͠· ͢ w ࣗຫͰ͖ΔϓϩάϥϚͱҰॹʹಇ͍ ͯ·͢ w ·ͩ·͍ͩΖ͍Ζ͕͋Δ͚ͲҰ ॹʹઓͬͯ͘ΕΔͻͱ୳ͯ͠·͢