CLEAN-2: The outer architectural layer should contain the entirety of the app’s UI components.


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.


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:

Login Injection

MVVM depicted:

Login Injection

Check out the MVP example and the MVVM example to view the complete repositories.