Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
DI-antiPattern.pdf
Search
shindyu
December 20, 2018
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
DI-antiPattern.pdf
shindyu
December 20, 2018
More Decks by shindyu
See All by shindyu
iPhone へのマイナンバーカード搭載におけるデータ規格についての理解を深める
shindyu
2
2.2k
Embedded frameworkを利用して既存プロジェクトでも爆速でTDD
shindyu
2
1k
テスト駆動で会社アプリと個人アプリを開発してみて思ったこと
shindyu
0
770
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
7.1k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
290
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
390
My Coaching Mixtape
mlcsv
0
370
The Language of Interfaces
destraynor
162
27k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
The untapped power of vector embeddings
frankvandijk
2
2k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
290
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
670
A Tale of Four Properties
chriscoyier
163
24k
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/