Clinton Teegarden
1 min readMar 1, 2020

--

Hi Roman — great question. The only implementation details that the ViewModel knows about is the class to be launched after a specific event and possibly what arguments your event may want to provide it. This could be done in many ways, such as creating an Event wrapper that performs some logic in the View to determine the Navigation. Many of these Event wrappers expose implementation details and still require logic to exist in the View that is much harder to test. With this approach, you free your View from such logic and the testing is quite easy.

Modularizing your application comes with challenges with or without this pattern. However, modularization could actually make a pattern like this easier. For example, to open a modularized Activity, you could adjust the ActivityEvent to take in a DeepLink instead of the class. With Fragment modularization, however, your application already needs some form of backing to support this. I have seen this done in many ways, including DeepLinks. Whatever the solution used, adjusting FragmenrEvent to support it could be done. This would be no different than your View also needing this same adjustment to support modularized Fragments.

--

--

Clinton Teegarden
Clinton Teegarden

Written by Clinton Teegarden

Mobile Lead & Architect @ CapTech. I specialize in delivering products for Fortune 500 clients in Mobile, Services and end to end solutions.

No responses yet