there's no actual dependency injection
# android
j
there's no actual dependency injection
d
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
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
well, some people just hate code-generation tools (for various reasons), so they better will use service locator instead of "true" di+`apt`
j
DI can be done entirely at runtime with libraries like Guice
d
yep. with reflection, which is another subject for hate 🙂
j
I hate code generation and reflection less than service lookup pattern.
s
is that mainly because of performance concerns?