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
0
41
Understanding Dagger2 Part1
FujiKinaga
November 20, 2018
Tweet
Share
More Decks by FujiKinaga
See All by FujiKinaga
最新のCompose Multiplatform を使うとiOSとAndroidアプリはどれくらい作れるのか
fujikinaga
2
590
Androidのテストの理解を深めてみた
fujikinaga
0
54
開発案件の進み方
fujikinaga
0
83
深いい勉強会 vol.10
fujikinaga
0
79
深いい勉強会 vol.9
fujikinaga
0
98
Mater of Subscription
fujikinaga
0
61
深いい勉強会
fujikinaga
2
67
深いい勉強会 The Navigation Component
fujikinaga
0
52
深いい勉強会
fujikinaga
0
65
Other Decks in Programming
See All in Programming
Exploring: Partial and Independent Composables
blackbracken
0
100
テストコード書いてみませんか?
onopon
2
130
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
470
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
450
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
150
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
820
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
190
Spatial Rendering for Apple Vision Pro
warrenm
0
110
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Optimising Largest Contentful Paint
csswizardry
33
3k
How STYLIGHT went responsive
nonsquared
95
5.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Bash Introduction
62gerente
608
210k
The Cost Of JavaScript in 2023
addyosmani
45
7k
Building Your Own Lightsaber
phodgson
103
6.1k
Producing Creativity
orderedlist
PRO
341
39k
A designer walks into a library…
pauljervisheath
204
24k
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.