Hi All, is it safe to use two DI frameworks (Koin ...
# android
y
Hi All, is it safe to use two DI frameworks (Koin & Hilt) at the same time in an Android project (temporarily)
šŸ‘Œ 3
😶 3
k
Temporarily in many cases become forever. I wouldn't risk it.
šŸ‘Œ 2
šŸ†— 2
šŸ™ 3
p
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
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
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’.
šŸ‘Œ 1
šŸ™ 1
🤦 1