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
FujiKinaga
November 20, 2018
Programming
64
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
71
開発案件の進み方
fujikinaga
0
110
深いい勉強会 vol.10
fujikinaga
0
94
深いい勉強会 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
Xdebug と IDE による デバッグ実行の仕組みを見る / Exploring-How-Debugging-Works-with-Xdebug-and-an-IDE
shin1x1
0
350
Offline should be the norm: building local-first apps with CRDTs & Kotlin Multiplatform
renaudmathieu
0
150
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
4
2.9k
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
220
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
190
「速くなった気がする」をデータで疑う
senleaf24
0
150
おれのAgentic Coding 2026/03
tsukasagr
1
140
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
140
SkillがSkillを生む:QA観点出しを自動化した
sontixyou
6
3.1k
Don't Prompt Harder, Structure Better
kitasuke
0
460
アーキテクチャモダナイゼーションとは何か
nwiizo
17
4.6k
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
340
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1k
How to Talk to Developers About Accessibility
jct
2
170
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.5k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
450
Six Lessons from altMBA
skipperchong
29
4.2k
ラッコキーワード サービス紹介資料
rakko
1
2.9M
Embracing the Ebb and Flow
colly
88
5k
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
220
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.