https://kotlinlang.org logo
#android
Title
# android
d

dalexander

06/27/2018, 5:41 PM
Probably Dagger 2? But some devs have found dependency injection is less useful on Kotlin projects, so you might consider whether you need it or not.
c

chi

06/27/2018, 6:51 PM
Why would some devs consider dependency injection less useful on Kotlin projects? simple smile
d

dalexander

06/27/2018, 6:57 PM
Because there are other ways of solving the problems DI is typically used for, like delegates. Things like singletons and lazy objects which are another use case for Dagger, are also gracefully handled by Kotlin. https://blog.indoorway.com/how-to-reproduce-dagger-functions-or-develop-your-own-di-in-kotlin-b8dfd5cdea0c is an article I saw a while ago where they talked specifically about replacing their Dagger usage with Kotlin constructs.
👍 1
u

ursus

06/28/2018, 12:01 AM
@dalexander DI is pattern, that allows swapping of objects dependencies, in order to allow unit testing, nothing more. And if you believe in unit testing, then ALL of your code you should be DI compatible, regardless of language, framework, whatever
2
4 Views