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

jw

09/12/2017, 5:47 PM
there's no actual dependency injection
d

deviant

09/13/2017, 3:16 PM
tools like Kodein allows you to define dependencies outside of target object. You pass it via
kodein
object. But the irony is: Dagger works almost the same. in 90% cases you need
component
object to be passed to `activity`/`fragment` in some way
j

jw

09/13/2017, 3:19 PM
Yeah that's a service lookup pattern, not dependency injection. Very similar to how
Context
has
getSystemService
.
I wouldn't use that pattern unless there was no other choice (such as being forced to by the Android framework).
d

deviant

09/13/2017, 3:21 PM
well, some people just hate code-generation tools (for various reasons), so they better will use service locator instead of "true" di+`apt`
j

jw

09/13/2017, 3:24 PM
DI can be done entirely at runtime with libraries like Guice
d

deviant

09/13/2017, 3:24 PM
yep. with reflection, which is another subject for hate 🙂
j

jw

09/13/2017, 3:26 PM
I hate code generation and reflection less than service lookup pattern.
s

stantronic

09/15/2017, 2:29 PM
is that mainly because of performance concerns?