Let’s talk about MVP
If you are an android developer then it’s especially for you but other software engineers also can go through it.MVP is amazing (;
What is MVP?
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 command to UI actions and listen 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.
Need of 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 to solve 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.