Hello there, I am trying to programming an app bas...
# android
m
Hello there, I am trying to programming an app based on SOLID principles, and sometimes I see that my ViewModel is doing a lot of work(More than it should) and I would like to know what do I need to avoid this? Should I have one ViewModel for each fragment? or they can share based on the lifecycle? Thanks in advance.
f
If you are really using SOLID, then your
ViewModel
cannot do too much work, since the first rule of SOLID is “single-responsibility”. You should probably split up your
ViewModel
and only use it as a delegate to “deeper” code (services, use-cases, interactors, navigators, coordinators, repositories or whatever you use in your architecture).
4