GENERIC-5: When starting a new project, carefully select a fitting architectural pattern to adhere to.


Description

Picking the right architectural pattern (e.g., MVP or MVVM) for the context and business goals of the app is a crucial decision. By adhering to an architectural patter selected a priori, separating responsibilities into components becomes a more straightforward process, and the growth of architectural technical debt is hindered. It is important to note that, when a certain level of adaptability/maintainability is not required, the selection of an ill-suited architectural pattern might lead to over-engineering. Choosing the architectural pattern to adopt is hence a nontrivial decision which should be taken by considering the context of apps, and their business/organizational goals.

Example

We created two examples:

  • MVVM example
  • MVP example

Our MVVM example depicted:

MVVM depicted

Our MVVM example depicted:

MVVM depicted

Both the MVVM architecture and the MVP are both recommended architectures when developing Android applications. As we can see choosing these architectures each component (model, view, presenter/ ViewModel) has its own responsibilities. Which makes improves testing and so also maintainability because each component can be tested separately. So whenever a test fails, it can be directly seen from which component this test fails.

Check out both the MVVM example and the MVP example on these links.