SlideShare a Scribd company logo
Model View
Presenter
Indonesia
Dubai, February 2016
Rendra Toro
2
why MVP
3
● Timeline very long for one task or feature on development
to release/live
● Need to change from Manual Test to Automated Testing
● It took a lot of time try to code Automated Testing
● New method Test Driven Development
Things we faced before using MVP
4
Model–view–presenter (MVP) is a
derivation of the model–view–controller
(MVC) architectural pattern, and is used
mostly for building user interfaces.
5
MVP Diagram
VIEW
PRESENTER
MODEL
User Event Updates Views
Updates Model State-Change Events
6
iOS implementation
7
• View: displays what it is told to by the Presenter and relays user input back to
the Presenter.
• Interactor: contains the business logic as specified by a use case.
• Presenter: contains view logic for preparing content for display (as received
from the Interactor) and for reacting to user inputs (by requesting new data
from the Interactor).
• Entity: contains basic model objects used by the Interactor.
• Routing: contains navigation logic for describing which screens are shown in
which order.
VIPER mean :
8
How they Connected
9
Android Implementation
10
Models, Net, DataStoreFactory, Repositories, Model Mapper
Interfaces
Business Rules (App Workflow, Validation)
Interfaces
View View View View View View
Detail Ad PageHome Page Search Page Chat PageMyaccount Page Other Pages
VIEW
PRESENTER
MODEL
11
● Platform Specific View (Android: Fragment, Adapter,
Activity, iOS: UIViewController, Storyboard, UITableView)
● Passive, limit action to model and presenter
View
12
View Diagrams
View Interface
Android/iOS Impl
Presenter
presenter.
getListing() view.showLoading() view.showRequestError() view.generateData()
2
1
3
Presenter
Interface
view.showLoading()
view.showRequestError()
view.generateData()
presenter.getListing()
13
Presenter
● Business Rules happened here.
● Pure Java/Obj-C module without any android/iOS
dependencies.
● Connection to, and from Presenter are done via interfaces
/ abstract class.
14
Presenter Diagrams
Model
View Interface
Presenter
Validation
Workflow
Interactors
Background Thread
onSuccess(Entity entity)
onFailed(Exception e)
Repositories
Interface
Android/iOS Impl
2
3
4
Presenter
Interface
1
Other Java/Obj-c
View Impl
presenter.getListing()
view.showLoading()
view.showRequestError()
view.generateData()
15
Model
● All data needed for the application are provided here via
Repository Implementation.
● DataStoreFactory responsible for loading data via cache
or API depends on the situation.
● Data origin is encapsulated from the client.
Model Diagrams
OlxService
CommunicationImpl
Communication
Interface
APIDataSource StorageDataSource
Repositories
Storage
DataSource
Interface
DataStoreFactory
Presenter
Repositories
Interface
1
2
3
17
Benefits
● Each class has single responsibility,
● Each layer can be tested,
● Abstraction,
● Scalable,
● Easy to maintain.
18
Road to Test Driven Development
● MVP
● Dependency Injection (Dagger 2)
● Unit Testing
19
Android Libraries
● Retrofit
● Butter Knife (View Injection)
● Dagger 2 (Dependency Injection)
Android Unit Test Libraries
● View - Espresso
● Presenter - JUnit, Mockito
● Model - Robolectric, JUnit, Mockito
20
References
http://fernandocejas.com/2014/09/03/architecting-android-the-clean-way/
https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html
http://antonioleiva.com/mvp-android/
https://www.objc.io/issues/13-architecture/viper/
Q & A

More Related Content

PPTX
Introduction to selenium
PPTX
Api Testing
PPTX
What is component in reactjs
PPTX
Selenium WebDriver training
PPT
principles of object oriented class design
PPTX
Java 8 lambda
PDF
PPTX
React Class Components vs Functional Components: Which is Better?
Introduction to selenium
Api Testing
What is component in reactjs
Selenium WebDriver training
principles of object oriented class design
Java 8 lambda
React Class Components vs Functional Components: Which is Better?

What's hot (20)

PPTX
API Automation Testing Using RestAssured+Cucumber
PDF
Data Grids with Oracle Coherence
PPT
Spring Framework
PPT
Object Oriented Concepts and Principles
PPTX
Rest assured
PPTX
New Features in JDK 8
PPTX
API Testing Using REST Assured with TestNG
PPTX
PPTX
Java 8 streams
PDF
Java 8 Lambda Expressions
PDF
Java8 features
PDF
Best Practice-React
PDF
Java11 New Features
PPTX
Java Spring Framework
PPTX
Spring boot
PDF
Introduction to Robot Framework
PDF
Performance testing presentation
PPTX
Spring beans
PDF
Karate, the black belt of HTTP API testing?
PPTX
Automation - web testing with selenium
API Automation Testing Using RestAssured+Cucumber
Data Grids with Oracle Coherence
Spring Framework
Object Oriented Concepts and Principles
Rest assured
New Features in JDK 8
API Testing Using REST Assured with TestNG
Java 8 streams
Java 8 Lambda Expressions
Java8 features
Best Practice-React
Java11 New Features
Java Spring Framework
Spring boot
Introduction to Robot Framework
Performance testing presentation
Spring beans
Karate, the black belt of HTTP API testing?
Automation - web testing with selenium
Ad

Viewers also liked (17)

PDF
Tdd in android (mvp)
PDF
Ceo vision dave power
PDF
Access tutorial (1)
PDF
D shimmerman (1)
PPTX
chatarra tecnológica
PPTX
Presentación graffiti
PPTX
chatarra tecnológica
PDF
Fortune Hill San Juan Presentation
PDF
Joseph Jaffe Zero Paid Media as the New Marketing Model
PDF
Comment vendre davantage et plus vite avec le marketing de contenu?
PPTX
Vinia Residences in Quezon City
PDF
Defensoria eprac samsa
PPSX
PodCas't
PPTX
Presentation aqt 2014 (1)
PDF
2015-42-4_6
Tdd in android (mvp)
Ceo vision dave power
Access tutorial (1)
D shimmerman (1)
chatarra tecnológica
Presentación graffiti
chatarra tecnológica
Fortune Hill San Juan Presentation
Joseph Jaffe Zero Paid Media as the New Marketing Model
Comment vendre davantage et plus vite avec le marketing de contenu?
Vinia Residences in Quezon City
Defensoria eprac samsa
PodCas't
Presentation aqt 2014 (1)
2015-42-4_6
Ad

Similar to Model View Presenter (20)

PPTX
Rendra Toro - Model View Presenter
PPTX
Mvp tech talks
PDF
How to tdd your mvp
PDF
Application architecture pattern
PPTX
Android DesignArchitectures.pptx
PPTX
MVP vs MVVM : a fast introduction
PPTX
MVVM presentation
PPTX
MVVM ( Model View ViewModel )
PDF
MVP Clean Architecture
PPTX
Slide Presentation of MVP Pattern Concept
PDF
Android-centric-architecture vs. unit testable apps
PDF
Ui design patterns
PPT
Code Camp 06 Model View Presenter Architecture
PDF
PPTX
Mobile App Architectures & Coding guidelines
PPTX
Mvc vs mvp vs mvvm a guide on architecture presentation patterns
PDF
Clean VIP (Clean Swift) architecture
DOCX
Mvc, mvp & mvvm (erp)
PPTX
реалии использования Mv в i os разработке
PDF
How I Accidentally Discovered MVVM
Rendra Toro - Model View Presenter
Mvp tech talks
How to tdd your mvp
Application architecture pattern
Android DesignArchitectures.pptx
MVP vs MVVM : a fast introduction
MVVM presentation
MVVM ( Model View ViewModel )
MVP Clean Architecture
Slide Presentation of MVP Pattern Concept
Android-centric-architecture vs. unit testable apps
Ui design patterns
Code Camp 06 Model View Presenter Architecture
Mobile App Architectures & Coding guidelines
Mvc vs mvp vs mvvm a guide on architecture presentation patterns
Clean VIP (Clean Swift) architecture
Mvc, mvp & mvvm (erp)
реалии использования Mv в i os разработке
How I Accidentally Discovered MVVM

More from rendra toro (7)

PDF
PDF
Android smarter with TensorFlow
PDF
BEKRAF Developer Day Bogor - May 2017
PDF
Resep jadi rockstar developer
PDF
Ci/CD Android
PDF
Andrew - Job scheduler
PDF
Android - Model Architecture
Android smarter with TensorFlow
BEKRAF Developer Day Bogor - May 2017
Resep jadi rockstar developer
Ci/CD Android
Andrew - Job scheduler
Android - Model Architecture

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Transform Your Business with a Software ERP System
PDF
System and Network Administration Chapter 2
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
history of c programming in notes for students .pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
AI in Product Development-omnex systems
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
ai tools demonstartion for schools and inter college
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Introduction to Artificial Intelligence
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Transform Your Business with a Software ERP System
System and Network Administration Chapter 2
Odoo POS Development Services by CandidRoot Solutions
history of c programming in notes for students .pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
AI in Product Development-omnex systems
How to Migrate SBCGlobal Email to Yahoo Easily
How to Choose the Right IT Partner for Your Business in Malaysia
ISO 45001 Occupational Health and Safety Management System
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
ManageIQ - Sprint 268 Review - Slide Deck
ai tools demonstartion for schools and inter college
Online Work Permit System for Fast Permit Processing
Operating system designcfffgfgggggggvggggggggg
Introduction to Artificial Intelligence
Softaken Excel to vCard Converter Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf

Model View Presenter