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
DI-antiPattern.pdf
Search
shindyu
December 20, 2018
0
73
DI-antiPattern.pdf
shindyu
December 20, 2018
Tweet
Share
More Decks by shindyu
See All by shindyu
iPhone へのマイナンバーカード搭載におけるデータ規格についての理解を深める
shindyu
2
590
Embedded frameworkを利用して既存プロジェクトでも爆速でTDD
shindyu
2
920
テスト駆動で会社アプリと個人アプリを開発してみて思ったこと
shindyu
0
690
Featured
See All Featured
Clear Off the Table
cherdarchuk
91
320k
How GitHub (no longer) Works
holman
310
140k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
It's Worth the Effort
3n
182
27k
VelocityConf: Rendering Performance Case Studies
addyosmani
322
23k
Optimising Largest Contentful Paint
csswizardry
31
2.8k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
1
54
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
363
22k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
123
18k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
45
4.8k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Transcript
DEPENDENCY INJECTION ANTI-PATTERNS @SHINDYU
DEPENDENCY INJECTION ANTI-PATTERNS SELF-INTRODUCTION ▸ ৽ಊ ܟོ / @shindyu ▸
ϠϑΦΫ! iOS ▸ ٕज़ॻయ̑ͰςετຊΛॻ͖·ͨ͠ʂ https://booth.pm/ja/items/1040471
DEPENDENCY INJECTION ANTI-PATTERNS DEPENDENCY INJECTION ▸ ґଘੑͷೖ ʰ͋ΔΦϒδΣΫτʹରͯ͠ґଘؔͷ͋ΔผͷΦϒδΣΫ τΛ֎෦͔Β͢͜ͱʱ ▸
ͷ ▸ ςετ͍͢͠
DEPENDENCY INJECTION ANTI-PATTERNS DEPENDENCY INJECTION PATTERNS ▸ Constructor Injection ▸
Property Injection ▸ Method Injection ▸ Ambient Context
DEPENDENCY INJECTION ANTI-PATTERNS DEPENDENCY INJECTION PATTERNS ▸ Constructor Injection ▸
Property Injection ▸ Method Injection ▸ Ambient Context
DEPENDENCY INJECTION ANTI-PATTERNS DEPENDENCY INJECTION PATTERNS ▸ Constructor Injection ▸
Property Injection ▸ Method Injection ▸ Ambient Context
DEPENDENCY INJECTION ANTI-PATTERNS DEPENDENCY INJECTION PATTERNS ▸ Constructor Injection ▸
Property Injection ▸ Method Injection ▸ Ambient Context
DEPENDENCY INJECTION ANTI-PATTERNS DEPENDENCY INJECTION PATTERNS ▸ Constructor Injection ▸
Property Injection ▸ Method Injection ▸ Ambient Context
DEPENDENCY INJECTION ANTI-PATTERNS DEPENDENCY INJECTION PATTERNS ▸ Constructor Injection ▸
Property Injection ▸ Method Injection ▸ Ambient Context
DEPENDENCY INJECTION ANTI-PATTERNS ANTI-PATTERNS ▸ Control Freak ▸ Bastard Injection
▸ Service Locator
DEPENDENCY INJECTION ANTI-PATTERNS CONTROL FREAK ▸ DI͞Ε͍ͯͳ͍ঢ়ଶ ▸ StableͱVolatileΛݟۃΊͯDIύλʔϯΛ͏
DEPENDENCY INJECTION ANTI-PATTERNS STABLE / VOLATILE ▸ Stable Dependency :
҆ఆͨ͠ґଘؔ ▸ ex) ෦ͰͷΈར༻͢ΔϞδϡʔϧ ▸ Volatile Dependency : شൃੑͷ͋Δґଘؔ ▸ ex) ཚɺ࣌ؒΛར༻͢ΔϞδϡʔϧɺ ɹ ฒߦ։ൃதͰFIX͍ͯ͠ͳ͍ґଘؔ
DEPENDENCY INJECTION ANTI-PATTERNS BASTARD INJECTION ▸ ConstructorͷύϥϝʔλʹσϑΥϧτͱͯ͠ ֎෦ϞδϡʔϧΛࢦఆͯ͠͠·ͬͨঢ়ଶ
DEPENDENCY INJECTION ANTI-PATTERNS BASTARD INJECTION
DEPENDENCY INJECTION ANTI-PATTERNS BASTARD INJECTION
DEPENDENCY INJECTION ANTI-PATTERNS BASTARD INJECTION ▸ ςετॻ͖͍͢ ▸ ͕ɺ݁ہ֎෦Ϟδϡʔϧͷ࣮ʹґଘ͍ͯ͠ΔͷͰμϝ
DEPENDENCY INJECTION ANTI-PATTERNS BASTARD INJECTION ▸ ͜Ε͓ͦΒ͘Bastard InjectionͰͳ͍͕ ґଘ͕ؔΦϓγϣφϧͳΒMethod InjectionͰྑ͍
DEPENDENCY INJECTION ANTI-PATTERNS SERVICE LOCATOR
DEPENDENCY INJECTION ANTI-PATTERNS SERVICE LOCATOR
DEPENDENCY INJECTION ANTI-PATTERNS SERVICE LOCATOR ▸ ґଘؔΛ҉తʹӅ͍ͯ͠Δ ▸ ServiceLocatorͷґଘ͕ൃੜ͍ͯ͠Δ ▸
ServiceLocatorܦ༝Ͱ࡞ΒΕͨͷ͔֬ೝ͢Δඞཁ͕͋Δ
DEPENDENCY INJECTION ANTI-PATTERNS SUMMARY ▸ Dependency Injection ▸ Constructor Injection
▸ Property Injection ▸ Method Injection ▸ Ambient Context ▸ Anti-Patterns ▸ Control Freak ▸ Bastard Injection ▸ Service Locator ͍ͨͩ͠ύλʔϯΛཧղͯ͠ΑΓྑ͍ίʔυΛʂ
DEPENDENCY INJECTION ANTI-PATTERNS REFERENCES ▸ http://ilya.puchka.me/dependency-injection-in-swift/ ▸ https://www.future-processing.pl/blog/introduction-to- dependency-injection/