Description
In order to ensure a clear separation of concerns among the clean architecture layers of an app, it is paramount that everything related to Android UI is grouped in a module residing in the outer architectural layer. As the other architectural layers of the app should be “frontend agnostic” (see guideline CLEAN-1), different patterns (e.g., MVP or MVVM) can be implemented in this layer. Activities and Fragments should not handle any other logic than the one necessary to render the UI. This allows a clear separation of concern among the architectural layers of an app, enhancing the understandability, modifiable and testability of its components.
Example
If we compare our BossApplication with our MVVM example, we see that they are actually quite similar. They both use a repository to provide the data. If we want we can even build an MVVM from the model from our MVP BossAplication.
MVP depicted:
MVVM depicted:
Check out the MVP example and the MVVM example to view the complete repositories.