Middle
What approach to dependency injection (DI) do you plan to use?
sobes.tech AI
Answer from AI
I plan to use Dagger2/Hilt (if the project is in Kotlin with Gradle buildSrc/convention plugins or with the possibility of migration), as it is the de facto standard in the industry, provides static dependency graph verification, and has high performance.
Alternatives I also consider depending on the project scale and chosen stack:
- Koin: Lighter, convenient for small and medium Kotlin projects, does not require code generation.
- Kodein-DI: Another DI library for Kotlin based on DSL.
The choice of a specific approach depends on:
- Project language: Kotlin (Koin, Kodein) or Java (Dagger2).
- Project size: For large projects, Dagger2/Hilt is preferred due to static verification.
- Performance requirements: Dagger2/Hilt are generally faster at runtime.
- Team experience: If the team has already worked with a particular library, it can speed up development.
Ideally, I would aim to use Hilt as the recommended approach for new Android projects using Jetpack.