# WTF is MVP ?

DevFeed: [WTF is MVP ?](<https://devfeed.tech/articles/wtf-is-mvp-20006.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2016/11/17/wtf-is-mvp/>)

Published: 2016-11-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [App](<https://devfeed.tech/topics/app.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Automation](<https://devfeed.tech/topics/automation.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [app](<https://devfeed.tech/tags/app.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [automation](<https://devfeed.tech/tags/automation.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

This article explains Model-View-Presenter (MVP) architecture for software engineers developing apps, especially Android apps. It describes how the Model, View, and Presenter separate responsibilities, improve maintainability and readability, and support rigorous testing. It also introduces layer contracts and discusses using fragments for tablet layouts.

## Source excerpt

If you are here searching for answers about Minimum Viable Product or you are here as a result of watching the first episode of the first season of Silicon Valley, this might not be the blog you are looking for. If you are a software engineer and you develop apps (especially on Android), this is a must read. Either way, you can share this blog among other software developers you know! :) Model-View-Presenter MVP stands for Model, View, Presenter. MVP is a way to abstract or decouple different components to make them independent of each other. This makes the codebase cleaner, improves readability, improves maintainability and also helps in rigorous testing. Model : Data access layer such as database API or remote server API. View : Layer that shows/displays data and reacts to user actions. This could be an Activity, Fragment, View or Dialog. This contains almost no logic. Converts presenters commands to UI actions and listens to user actions which are passed to the presenter. Presenter : Layer that provides View with the data from Model. Presenters essentially sits in between Models and Views. Why do we need MVP ? KISS : Stands for Keep It Simple, Stupid or Keep It Stupid Simple. Don't fight with the Views. Fight with business logic. Decouple : Helps in concentrating on the problem. Helps solving issues like configuration changes, background tasks, etc Most problems will be handled by the architecture itself and the app wouldn't need external libraries to handle specific issues. Rigorous testing : Helps in building testable apps by writing automation tests. How do we develop apps for the next billion users ? We start defining contracts for each layer. A contract is a class or an agreement. We define contracts for all the layers in the architecture - Model, View and Presenter. Let's take an example of showing the latest challenges on HackerEarth to users. ChallengesContract.java class defines two interfaces, one each for the View and the Presenter. The view specific f