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
Understanding Dagger2 Part1
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
FujiKinaga
November 20, 2018
Programming
65
0
Share
Understanding Dagger2 Part1
FujiKinaga
November 20, 2018
More Decks by FujiKinaga
See All by FujiKinaga
Flutterで実装する実践的な攻撃対策とセキュリティ向上
fujikinaga
2
1.2k
最新のCompose Multiplatform を使うとiOSとAndroidアプリはどれくらい作れるのか
fujikinaga
2
700
Androidのテストの理解を深めてみた
fujikinaga
0
72
開発案件の進み方
fujikinaga
0
110
深いい勉強会 vol.10
fujikinaga
0
95
深いい勉強会 vol.9
fujikinaga
0
120
Mater of Subscription
fujikinaga
0
80
深いい勉強会
fujikinaga
2
84
深いい勉強会 The Navigation Component
fujikinaga
0
74
Other Decks in Programming
See All in Programming
iOS機能開発のAI環境と起きた変化
ryunakayama
0
190
VueエンジニアがReactを触って感じた_設計の違い
koukimiura
0
190
Oxlintとeslint-plugin-react-hooks 明日から始められそう?
t6adev
0
290
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
160
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
230
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
820
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
250
Agentic Elixir
whatyouhide
0
410
NakouPAY説明用
annouim0
0
270
t *testing.T は どこからやってくるの?
otakakot
1
790
アーキテクチャモダナイゼーションとは何か
nwiizo
19
5.5k
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
290
Featured
See All Featured
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
240
Producing Creativity
orderedlist
PRO
348
40k
Designing for Timeless Needs
cassininazir
0
210
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
99
How to build a perfect <img>
jonoalderson
1
5.4k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
160
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.4k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
680
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
820
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
190
The browser strikes back
jonoalderson
0
990
Transcript
Understanding Dagger2 ਂ͍͍ษڧձ#8 Fuji
What’s Dagger2, why use it? • DI (Dependency Injection) Library
• Easy to test • Manage Lifecycle • Module sharing, reusing, replacing • Auto code generating with annotation • Ikeike, Cool, Kacchoiiiiiiiiiii
Կ͕ศརʁ • ଞͷΫϥεͷґଘؔΛݮΒͤΔͨΊɺΫϥε͝ ͱͷςετΛॻ͖͘͢ͳΔ • ͍·Θ͍ͨ͠ΠϯελϯεΛ؆୯ʹఆٛͰ͖Δ& ҰݩཧͰ͖Δ • ϘΠϥʔϓϨʔτͳίʔυΛݮΒͤΔ •
ContextΛߦّͷྑ͍ํ๏Ͱ֤ΫϥεʹͤΔ
Constitution • @Inject - ϑΟʔϧυσʔλίϯετϥΫλʹ͚ΔͱରΦϒδΣΫτΛnew͠ͳͯ͘ injectΛݺΜͩλΠϛϯάͰউखʹ࡞ͬͯ͘ΕΔ • Module - new
͍ͨ͠ͷΛఆ͓ٛͯ͘͠ͱ͜Ζ • Component - ֤Moduleಉ࢜ΛͲͷΑ͏ʹඥ͚(ґଘ)ͤ͞Δ͔Λఆٛ͢Δͷ - Moduleಉ͕࢜ࢠؔͱͳΓɺࢠͷModuleࢀরͰ͖Δ • Scope - ComponentΛͲΕ͘Β͍ͷؒੜଘͤ͞Δ͔Λཧ͢Δͷ
Component & Module & Scope
͞Βʹࡉ͔͘ʂ
Jake͞ΜͷεϥΠυ͕Θ͔Γ ͍͢ͷͰҠಈʂ
Ͳ͏͍͏෩ʹΦϒδΣΫτ͕ ΠϯδΣΫτ͞Ε͍ͯ͘ͷ͔
͏গ͠ࡉ͔͘ʂ
Jake͞ΜͷεϥΠυ͕Θ͔Γ ͍͢ͷͰҠಈύʔτ2ʂ
طଘͷnanaͷDaggerͷ ΈΑΓͬͱྑ͍ํ๏Λߟ ͑ͯΈΔ
ͬͱྑ͍ํ๏Ҋ • Dagger.android֦ுΛͬͯ͞ΒʹϘΠϥʔϓϨʔτίʔ υΛݮΒ͍ͯ͘͠ • ActivityComponent/ModuleͱFragmentComponent/ ModuleΛ͞Βʹݫີʹཧ͢Δ - MainActivityModuleɺSetupActivityModuleɺ RecordActivityModuleͳͲ
- RepositoryΫϥε(SwaggerͷΧςΰϦͷཻ)ͱಉ͡ྖҬ Ͱ͚ͨΓͯ͠ྑͦ͞͏
࣮ࡍʹॻ͍ͯΈͨ
ଓ͘ɻ (Ϗϧυ௨ͬͨ)
References • Dagger2 ೖղઆ - https://qiita.com/MoyuruAizawa/items/ 26cb093adbc778013467 • Dependency Injection
with Dagger2 - https://jakewharton.com/dependency-injection-with-dagger-2/ • Dagger Android֦ுͷ͍ํ - https://medium.com/@star_zero/dagger- android%E6%8B%A1%E5%BC%B5%E3%81%AE%E4%BD%BF %E3%81%84%E6%96%B9-6527dcb74531
Next Steps • Helping Dagger Help You - https://jakewharton.com/helping-dagger-help-you/ •
Dagger2 - Subcomponent vs dependencies - http://yuki312.blogspot.com/2016/02/android- dagger2-subcomponent-vs.html • Dagger2 - MultibindingͰComponentΛ៉ྷʹ্͛Δ - http://yuki312.blogspot.com/2017/02/dagger2- multibindingcomponent.html
Fin.