Please enable JavaScript.
Coggle requires JavaScript to display documents.
Patterns of design - Coggle Diagram
Patterns of design
MVP: Model-View-Presenter
The MVP architectural pattern is commonly used in Android and iOS app development. As well as MVC, MVP consists of three components defined as follows:
Model stores business logic and data, handling communication between the database and the network.
View is an interface that displays the data and transfers user input to the presenter.
Presenter is responsible for querying the model and translating updates in the view accordingly, as the view has no direct access to the model.
MVC: Model-View-Controller
MVC is fairly one of the most common approaches to building a mobile app architecture. Being a layer-based pattern, MVC separates user interface functionality from business/application/domain logic. As the name implies, this pattern consists of three main components and layers respectively:
Model is a data holder, responsible for handling the business logic and defining rules to modify and operate data.
View is a visual part and makes data from the model visible in the user interface.
Controller is a front and back communicator between the model and the view. Based on the user behavior input from the view, it could change the model, process data through it and pass the results back to the view.
MVVM: Model-View-ViewModel
Having emerged after MVC and MVP, the MVVM pattern is like an upgraded version of these two. The view and the model act the same as in both previous cases, but the view model becomes the intermediary. MVVM aims to keep the UI code simple, making it easy to manage:
The view represents the UI, and the view model is responsible for presentation logic, capturing data from the model. This way UI is separated from the business logic code, and testing can be performed on the view models.
VIPER: View-Interactor-Presenter-Entity-Router
VIPER was mainly used in iOS, but today, Android developers start switching to it more often. It is a clean mobile application architecture to keep the code organized and modular. The VIPER components are:
View transfers user input to the presenter.
Interactor holds the business logic.
Presenter holds the view logic and prepares content for display.
Entity contains model objects which are used by the interactor.
Router holds navigation logic.