Probably Dagger 2? But some devs have found depen...
# android
d
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
Why would some devs consider dependency injection less useful on Kotlin projects? simple smile
d
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
@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