https://kotlinlang.org logo
#koin-contributors
Title
# koin-contributors
p

Pedro Francisco de Sousa Neto

05/26/2022, 3:04 PM
Hey guys, I need advice here. Let’s imagine an android app with hundreds of features. Each feature has one or multiple activities with you N fragments. Each host activity has your Koin module with scope tied to activity. What approach is better? 1. load and unload these activity tied koin modules in each activity host; 2. load and unload these activity tied koin modules in Application class; I think the second option it’s easy to maintain because host activities didn’t care with Koin load/unload and the tied scope can solve this in runtime. But… I don’t know if this case will be less performatic then first option.
m

Marcello Galhardo

05/28/2022, 11:59 AM
I would go with option 2. It is easier to maintain (and also to validate in unit tests the graph). I would only do option 1 if I have numbers to prove the performance is significant enough for my app's graph, and it would payoff the additional maintenance cost...
🤝 1
a

arnaud.giuliani

05/30/2022, 9:23 AM
why load/unload modules if you use scopes?
p

Pedro Francisco de Sousa Neto

05/30/2022, 5:30 PM
I thought it would be lighter to load/unload modules in activity than doing this at application level. 😅
4 Views