Android Architecture Patterns (original) (raw)

Last Updated : 23 Jul, 2025

Modern mobile applications are dynamic, evolving over time to meet user needs. As these apps gets complex day by day, it becomes essential to separate core logic from UI components (such as activities and fragments). To structure the project's code and to give it a modular design(separated code parts), architecture patterns are applied to separate the concerns. The most popular android architectures used by developers are the following:

The main idea of all these patterns is to organize the project in a proper way so that all the codes get covered in the Unit Testing. Moreover, it is very helpful in the maintenance of the software, to add and remove features and developers can keep a track of various crucial logic parts.

The Model-View-Controller(MVC) Pattern

MVC pattern is the oldest android app architecture which simply suggests separating the code into 3 different layers:

Android-Architecture-Pattern-1

How it works?

In a typical MVC setup, both the View and the Controller depend on the Model. For example, a user interaction in the View triggers the Controller to update the Model, after which the View is updated with the new data. Depending on the approach, developers can:

Advantages:

Disadvantages:

The Model-View-Presenter(MVP) Pattern

MVP pattern is the second iteration of Android app architecture. This pattern is widely accepted and is still recommended for upcoming developers. The purpose of each component is easy to learn:

Android-Architecture-Pattern-2

How it works?

In the MVP schema, View and Presenter are closely related and have a reference to each other. To make the code readable and easier to understand, a **Contract interface class is used to define the Presenter and View relationship. The View is abstracted and has an interface in order to enable the Presenter for Unit Testing.

Advantages:

Disadvantages:

The Model-View-ViewModel (MVVM) Pattern

With the introduction of MVVM architecture pattern, it has become increasingly popular. It prioritises a clear separation between and UI and business logic while using data binding to enhance the communication between layers. Below are the separate code layers:

The MVVM and MVP patterns are quite similar because both are efficient in abstracting the state and behavior of the View layer. In MVVM, Views can bind itself to the data streams which are exposed by ViewModel.

Android-Architecture-Pattern-3

How it works?

Differences between MVC, MVP, and MVVM Architecture Pattern

Aspect MVC MVP MVVM
Dependency on Android API High Low Low or None
UI Layout (XML) Complexity Low Low Medium to High
Unit Testability Difficult Good Best
Modularity & Single Responsibility No Yes Yes

Advantages of Architecture

Disadvantages of Architecture