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
Dagger2 라이트하게 훑기
Search
Seungmin 마량
February 02, 2018
Technology
1
1.4k
Dagger2 라이트하게 훑기
2018년 2월 2일 GDG 안드로이드 라이트닝 토크에서 발표한 자료입니다. Dagger2를 배우기 위한 기본 이론부터 Dagger2 개념, 사용방법까지 라이트하게 다루었습니다.
Seungmin 마량
February 02, 2018
Tweet
Share
More Decks by Seungmin 마량
See All by Seungmin 마량
프론트엔드 개발자가 실제로 하는 일과 취업 준비 팁
maryang
0
8
나는 좋은 상사일까? 팀장은 꼭 봐야 할 리더십 공식
maryang
0
24
미국 교환학생 가서 무료 홈스테이 살면서 인턴 취업하기
maryang
0
110
글로벌 기업은 홈페이지에서 영어 번역을 어떻게 제공할까?
maryang
0
55
30살에 구글이 인정한 개발자가 될 수 있었던 공부법
maryang
0
140
좋은 서비스를 만들기 위한 제품팀 문화 이해하기
maryang
0
61
사수 없는 주니어 개발자가 성장하는 방법
maryang
0
360
개발자가 성과를 증명하는 방법 | A/B테스트 기반 개발
maryang
0
130
개발자가 동료의 업무효율을 높이는 방법 | 슬랙봇 개념부터 개발까지
maryang
0
200
Other Decks in Technology
See All in Technology
Oracle Cloud Infrastructure:2025年6月度サービス・アップデート
oracle4engineer
PRO
2
310
CI/CD/IaC 久々に0から環境を作ったらこうなりました
kaz29
1
200
「Chatwork」の認証基盤の移行とログ活用によるプロダクト改善
kubell_hr
1
240
なぜ私はいま、ここにいるのか? #もがく中堅デザイナー #プロダクトデザイナー
bengo4com
0
1.3k
整頓のジレンマとの戦い〜Tidy First?で振り返る事業とキャリアの歩み〜/Fighting the tidiness dilemma〜Business and Career Milestones Reflected on in Tidy First?〜
bitkey
0
340
プロダクトエンジニアリング組織への歩み、その現在地 / Our journey to becoming a product engineering organization
hiro_torii
0
140
ビギナーであり続ける/beginning
ikuodanaka
2
240
WordPressから ヘッドレスCMSへ! Storyblokへの移行プロセス
nyata
0
340
Node-RED × MCP 勉強会 vol.1
1ftseabass
PRO
0
180
生まれ変わった AWS Security Hub (Preview) を紹介 #reInforce_osaka / reInforce New Security Hub
masahirokawahara
0
370
解析の定理証明実践@Lean 4
dec9ue
1
200
Amazon Bedrockで実現する 新たな学習体験
kzkmaeda
2
680
Featured
See All Featured
Six Lessons from altMBA
skipperchong
28
3.9k
BBQ
matthewcrist
89
9.7k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
The Straight Up "How To Draw Better" Workshop
denniskardys
234
140k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
Agile that works and the tools we love
rasmusluckow
329
21k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
800
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Transcript
थ Drama&Company Seungmin Lee Dagger2 ۄೞѱ വӝ GDG উ٘۽٘ ۄ
ష
1. Daggerܳ ਤೠ ӝࠄѐ֛ ೧ೞӝ 2. Dagger ѐ֛ ೧ೞӝ 3.
Dagger ࢎਊೞӝ 4. ݃ޖܻ ݾର
Daggerܳ ਤೠ ӝࠄѐ֛ ೧ೞӝ Ƃ
DI Framework Daggerח ޖੌө?
Dependency Injection (ઓࢿ ੑ) DIח ޖੌө?
ઓࢿ ੑ ޖੌө? A classо B classܳ ઓೡ ٸ B
Object ࢤࢿਸ Aীࢲ ೞ ঋҊ ৻ࠗীࢲ ࢤࢿೞৈ ֈѹח Ѫ
ઓࢿ ੑ ޖੌө? Aо B,Cী ઓ Aীࢲ B,Cܳ ࢤࢿ
ઓࢿ ੑ ޖੌө? Aо B,Cী ઓ Aীࢲ B,Cܳ ࢤࢿ ৻ࠗীࢲ
B,Cܳ ࢤࢿೞৈ ֈӣ ઓࢿ ੑ!
DI Frameworkо যڌѱ ઓࢿਸ ੑೡө?
DI Frameworkо যڌѱ ઓࢿਸ ੑೡө? ஶపցח Spring ਊয ೞ݅ ߑध
ܳ ࡺ, ਗܻо э Daggerীࢲח Component৬ Module
IoCח ޖੌө? Inversion of Control (ઁয ) DIח IoC ҳഅߑߨ
ೞա
DIח ৵ ਃೡө? ёࢤࢿਸ ৻ࠗী ਤೣਵ۽ॄ Constructor Parameter ١ ࠁੌ۞
ۨ ٘ܳ ઁѢ
ઓࢿ ٘ܳ ݶ ޖ જо? ࠁੌ۞ ۨ ٘ܳ ઁѢೣਵ۽ॄ 1.
ӈଳ ঋ.
ઓࢿ ٘ܳ ݶ ޖ જо? ࠁੌ۞ ۨ ٘ܳ ઁѢೣਵ۽ॄ 1.
ӈଳ ঋ. 2. ٘ܳ ਬোೞѱ ߸҃ೡ ࣻ .
Dagger ѐ֛ ೧ೞӝ Ƃ
Daggerܳ ܖח ਃ ѐ֛ٜ 1.Inject 2.Component 3.Subcomponent 4.Module 5.Scope
Inject Componentীѱ ઓࢿ ੑਸ ਃ
Component Module۽ࠗఠ ࢤࢿػ ઓࢿ ёܳ ੑ
Subcomponent ࠗݽ Component Inner Component Subcomponent Module۽ ੑ पಁೞݶ, ࠗݽ
Component Moduleਸ Ѩ࢝ೠ
Module ઓࢿ ёܳ ࢤࢿ
Scope ࢤࢿػ ё Lifecycle ߧਤ PerActivity PerFragment …
Daggerо ઓࢿਸ ੑೞח Flow @Inject Subcomponent Module Scopeী ਵݶ return
হਵݶ ࢤࢿ
Daggerо ઓࢿਸ ੑೞח Flow @Inject Scopeী ਵݶ return হਵݶ ࢤࢿ
Subcomponent Module Scopeী ਵݶ return হਵݶ ࢤࢿ Module Subcomponent Moduleীࢲ ݏח ఋੑਸ ޅਵݶ ࢚ਤ Component
Daggerо ઓࢿਸ ੑೞח Flow @Inject
Dagger ࢎਊೞӝ Ƃ
@Singleton @Component(modules = {AndroidSupportInjectionModule.class, ActivityBindingModule.class, ApplicationModule.class}) public interface AppComponent extends
AndroidInjector<BaseApplication> { @Component.Builder interface Builder { @BindsInstance AppComponent.Builder application(Application application); AppComponent build(); } } Application Component
@Module public class ApplicationModule { @Provides Context providesContext(Application application){ return
application; } } Context ఋੑ ઓࢿ ёܳ ࢤࢿೠ Application Module
public class BaseApplication extends DaggerApplication { @Override protected AndroidInjector<? extends
DaggerApplication> applicationInjector() { return DaggerAppComponent.builder().application(this).build(); } } BaseApplication Component.inject() ೧ષ
@Module public abstract class ActivityBindingModule { @ActivityScoped @ContributesAndroidInjector(modules = TasksModule.class)
abstract TasksActivity tasksActivity(); @ActivityScoped @ContributesAndroidInjector(modules = TaskDetailPresenterModule.class) abstract TaskDetailActivity taskDetailActivity(); } ActivitySubcomponent ࢤࢿ
@Module public abstract class TasksModule { @FragmentScoped @ContributesAndroidInjector abstract TasksFragment
tasksFragment(); @ActivityScoped @Provides static TasksPresenter taskPresenter(){ return new TasksPresenter(); } } ActivitySubcomponent Module TasksPresenter ఋੑ ઓࢿ ёܳ ࢤࢿೠ
public class TasksActivity extends DaggerAppCompatActivity { @Inject TasksPresenter mTasksPresenter; @Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tasks_act); } } TasksActivity Component.inject() ೧ષ ઓࢿ ੑ ਃ
@Module public abstract class TasksModule { @FragmentScoped @ContributesAndroidInjector abstract TasksFragment
tasksFragment(); @ActivityScoped @Provides static TasksPresenter taskPresenter(){ return new TasksPresenter(); } } FragmentSubcomponent ࢤࢿ
@ActivityScoped public class TasksFragment extends DaggerFragment { @Inject TasksContract.Presenter mPresenter;
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mListAdapter = new TasksAdapter(new ArrayList<Task>(0), mItemListener); } } TasksFragment Component.inject() ೧ષ ઓࢿ ੑ ਃ
݃ޖܻ Ƃ
Inject ࢤࢿ @Injectо ઓࢿ ਃ ৻ী ёࢤࢿীب ࢎਊػ. పझ పझ
ё, पઁ ёܳ औѱ աׂ ࣻ . য়ט ޅ ࠁৈ٘ܽ Dagger Dagger2 ҕध ࢎ: https://google.github.io/dagger/ Dagger2ܳ ࢎਊೠ Google Architecture Sample: https://github.com/googlesamples/android-architecture/tree/todo-mvp-dagger/
Dagger ః ஶࣆ Daggerח Ӓې. Subcomponent, Component, Inject ࢤࢿ ࣽਵ۽
Ѩ࢝ೞৈ ઓࢿਸ ੑೠ.
ण࠺ਊ ֫݅ ఁפ. Ӓې ਗܻܳ ݺबೠݶ য۵ ঋইਃ. ನӝೞ݈Ҋ
ୌୌ ਊ೧ࠇद.
٘ۄ݃ঙஹಌפীࢲ ҳੋ೧ਃ ӝദ ٣ց ݃ா HR Android iOS Web Server
Data Engineering ࠁࠁউ goo.gl/UDcg97
थ Drama&Company Seungmin Lee хࢎפ Q&A