Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Flipping the Koin
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Roberto Orgiu
November 27, 2019
Programming
190
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Flipping the Koin
Slides of the talk I gave at Kotlin/Everywhere in Stockholm, St. Petersburg and Milan
Roberto Orgiu
November 27, 2019
More Decks by Roberto Orgiu
See All by Roberto Orgiu
Wellness & Droid
tiwiz
0
140
Behind the curtains
tiwiz
0
99
The Importance of Being Tested
tiwiz
0
470
An Android Dev start to Kotlin MPP
tiwiz
0
220
Fantastic API and where to find them
tiwiz
0
120
Flipping the Koin @ GDG Dev Party
tiwiz
1
84
Trip into the async world @ NYC Kotlin Meetup
tiwiz
0
140
Trip into the async world
tiwiz
1
170
GraphQL IRL (Android Makers)
tiwiz
0
170
Other Decks in Programming
See All in Programming
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
130
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
140
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
4
1.4k
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
120
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
1.6k
最近”作らせてる” ローカルAIアプリの話
akit37
0
520
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
200
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
4.9k
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
1.1k
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
7.1k
パスワード再設定メールのURLについて知っておこう
uyuki234
0
200
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3.1k
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
590
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
870
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
460
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Raft: Consensus for Rubyists
vanstee
143
7.8k
Ethics towards AI in product and experience design
skipperchong
2
450
How to make the Groovebox
asonas
2
2.5k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
620
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
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
Any questions? “
Use the tools You Like the most
Thanks!