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
79
DI-antiPattern.pdf
shindyu
December 20, 2018
Tweet
Share
More Decks by shindyu
See All by shindyu
iPhone へのマイナンバーカード搭載におけるデータ規格についての理解を深める
shindyu
2
1.3k
Embedded frameworkを利用して既存プロジェクトでも爆速でTDD
shindyu
2
960
テスト駆動で会社アプリと個人アプリを開発してみて思ったこと
shindyu
0
710
Featured
See All Featured
Become a Pro
speakerdeck
PRO
27
5.2k
Statistics for Hackers
jakevdp
798
220k
Thoughts on Productivity
jonyablonski
69
4.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Agile that works and the tools we love
rasmusluckow
328
21k
We Have a Design System, Now What?
morganepeng
51
7.5k
The Cult of Friendly URLs
andyhume
78
6.3k
Rails Girls Zürich Keynote
gr2m
94
13k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
A Philosophy of Restraint
colly
203
16k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
17
1.1k
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/