Hi All,
is it safe to use two DI frameworks (Koin & Hilt) at the same time in an Android project (temporarily)
š 3
š¶ 3
k
K Merle
08/18/2022, 4:09 PM
Temporarily in many cases become forever. I wouldn't risk it.
š 2
š 2
š 3
p
psh
08/18/2022, 4:44 PM
If you are migrating toward KMM, you will obviously have to use a multiplatform DI framework around the shared code, and over onto iOS. I think the reality of release schedules necessitates that Dagger in the Android UI code stay there for the time being. They co-exist but it causes confusion to know who manages what, which injection mechanism you should use in any given piece of code. I fall back to balancing ājust because you can, doesnt mean you shouldā (have them coexist) and āif it aint broke, dont fix it.ā (we have to release working code)
š 1
š 1
l
Landry Norris
08/18/2022, 9:39 PM
I feel like if thereās strong boundaries on where each is used, like with your example of dagger for UI and a multiplatform library for shared code, thereās less chance for confusion, but Iād definitely make sure that thereās a clear task to migrate completely on the roadmap. Iāve seen a number of temporary hacks to get a release out become a permanent part of the infrastructure.
š 1
š 1
Landry Norris
08/18/2022, 9:43 PM
I joined a project a couple years back, where there was a different backend for android and iOS, but both used the same database. To do anything, youād need to make several calls (fooAndroid, fooAndroid2, fooAndroid3, etc.) and the server used the phone as a sort of ātemporary memoryā, since it would send back unrelated variables in the response, and the next call would need those variables as parameters. Iād imagine it started with someone not wanting to set up caching in their āstatelessā XML API because there was a release and āIāll fix it laterā.