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
Flipping the Koin @ GDG Dev Party
Search
Roberto Orgiu
May 02, 2020
Programming
1
71
Flipping the Koin @ GDG Dev Party
Slides of my talk at GDG Dev Party Italy 2020
Roberto Orgiu
May 02, 2020
Tweet
Share
More Decks by Roberto Orgiu
See All by Roberto Orgiu
Wellness & Droid
tiwiz
0
120
Behind the curtains
tiwiz
0
63
The Importance of Being Tested
tiwiz
0
420
An Android Dev start to Kotlin MPP
tiwiz
0
180
Fantastic API and where to find them
tiwiz
0
76
Flipping the Koin
tiwiz
2
160
Trip into the async world @ NYC Kotlin Meetup
tiwiz
0
110
Trip into the async world
tiwiz
1
140
GraphQL IRL (Android Makers)
tiwiz
0
150
Other Decks in Programming
See All in Programming
Package Management Learnings from Homebrew
mikemcquaid
0
170
2026年 エンジニアリング自己学習法
yumechi
0
120
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
180
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
510
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.8k
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
650
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
600
CSC307 Lecture 01
javiergs
PRO
0
680
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
200
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
0
830
Featured
See All Featured
Building Applications with DynamoDB
mza
96
6.9k
Code Review Best Practice
trishagee
74
20k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
430
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
88
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
130
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
The Curse of the Amulet
leimatthew05
1
8.1k
The Cult of Friendly URLs
andyhume
79
6.8k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
240
Odyssey Design
rkendrick25
PRO
1
480
Transcript
R O B E R T O O R G
I U - @ _ t i w i z Flippin’ the Koin
Is there a difference? IMPLEMENTATION DI vs SL
DI Container Should only call itself Never called by others
Constructs objects
Service Locator Container Dependency
I’m not really answering this question WHAT IS DAGGER?
@Inject lateinit var myTarget: Target myComponent.inject(this) val myTarget = myComponent.getTarget()
insert-koin.io
Why I like it Kotlin DSL Quick setup Easy to
follow
I’m not really answering this question either WHAT IS KOIN?
private val target: Target by inject() inline fun <reified T
: Any> ComponentCallbacks.inject()
modules declaration val myModule = module { single<Target> { TargetImpl()
} factory { (view: View) -> Presenter(view, get() } viewModel { MyViewModel(get()) } }
Injection private val target: Target by inject { parametersOf(this) }
Injection private val target: Target by inject { parametersOf(this) }
Injection private val target: Target by inject { parametersOf(this) }
Injection val viewModel: MyViewModel by viewModel()
Injection class MyWorker : KoinComponent { override suspend fun doWork():
Result { val target: Target by inject() ... } }
Application startKoin { androidContext(context) androidLogger() modules( listOf(module1,..., moduleN) ) }
Let’s talk about testing “
JUnit + KoinTest
Dependencies koinApplication { androidContext(context) modules(fetchModules()) }.checkModules()
Dependencies koinApplication { androidContext(context) modules(fetchModules()) }.checkModules { create<MyClass> { parametersOf(mock1,...,paramN)
} }
Building a test
startKoin class MyTest : KoinTest { @Before fun setup() {
startKoin { androidContext(context) modules(fetchModules()) } } }
startKoin class MyTest : KoinTest { @Before fun setup() {
startKoin { androidContext(context) modules(fetchModules()) } } }
startKoin stopKoin class MyTest : KoinTest { @After fun tearDown()
{ stopKoin() } }
startKoin stopKoin class MyTest : KoinTest { @After fun tearDown()
{ stopKoin() } }
startKoin stopKoin Test
class MyTest : KoinTest { @Before fun setup() { startKoin
{...} } @Test fun my_test() { } }
class MyTest : KoinTest { @Before fun setup() { startKoin
{...} } @Test fun my_test() { } } private val target: Target by inject() declareMock<Target>() given(target).will { throw Exception() }
Dagger VS Koin
WARNING: Opinionated Ideas ahead
We should use Dagger
Quick setup
Compile time safety Because we all love it.
Scalability
Maintainability
androiddevs.it
Use the tools You Like the most
Thanks!