1
Model View
Presenter
Indonesia
Malang, April 2016
Rendra Toro - Intel Innovator Software
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
Android Implementation
7
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
8
● Platform Specific View :
Fragment
Adapter
Activity
● Passive, limit action to model and presenter
View
9
View Diagrams
View Interface
Android Impl
Presenter
presenter.getListin
g() view.showLoading() view.showRequestError() view.generateData()
2
1
3
Presenter
Interface
view.showLoading()
view.showRequestError()
view.generateData()
presenter.getListing()
10
Presenter
● Business Rules happened here.
● Pure Java module without any android dependencies.
● Connection to, and from Presenter are done via interfaces
/ abstract class.
11
Presenter Diagrams
Model
View Interface
Presenter
Validation
Workflow
Interactors
Background Thread
onSuccess(Entity entity)
onFailed(Exception e)
Repositories
Interface
Android Impl
2
3
4
Presenter
Interface
1
Other Java View Impl
presenter.getListing()
view.showLoading()
view.showRequestError()
view.generateData()
12
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
OlxServic
e
CommunicationImpl
Communication
Interface
APIDataSource StorageDataSource
Repositories
Storage
DataSource
Interface
DataStoreFactory
Presenter
Repositories
Interface
1
2
3
14
Benefits
● Each class has single responsibility,
● Each layer can be tested,
● Abstraction,
● Scalable,
● Easy to maintain.
15
Road to Test Driven Development
● MVP
● Dependency Injection (Dagger 2)
● Unit Testing
16
Android Libraries
● Retrofit
● Butter Knife (View Injection)
● Dagger 2 (Dependency Injection)
Android Unit Test Libraries
● View - Espresso
● Presenter - JUnit, Mockito
● Model - Robolectric, JUnit, Mockito
17
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://github.com/konmik/konmik.github.io/wiki/Introduction-to-Model-View-
Presenter-on-Android
Sample Code
https://github.com/CommunityShareCode/MVP
18
Q & A

More Related Content

PDF
Ci/CD Android
PDF
Sidiq Permana - Building For The Next Billion Users
PDF
Tren Pengembangan Aplikasi Android di 2021 - Ahmad Arif Faizin
PDF
Mengenal Software Development Life Cycle - Gilang Ramadhan
PDF
Fitur Terbaru Flutter di Tahun 2021 - Widyarso Joko Purnomo
PPTX
Automated Testing and Continuous Deployment for Mobile Apps with Jenkins
PDF
The operational side of Mobile Apps
PPTX
Automation Testing With Appium
Ci/CD Android
Sidiq Permana - Building For The Next Billion Users
Tren Pengembangan Aplikasi Android di 2021 - Ahmad Arif Faizin
Mengenal Software Development Life Cycle - Gilang Ramadhan
Fitur Terbaru Flutter di Tahun 2021 - Widyarso Joko Purnomo
Automated Testing and Continuous Deployment for Mobile Apps with Jenkins
The operational side of Mobile Apps
Automation Testing With Appium

What's hot (20)

PDF
Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...
PPTX
ATAGTR2017 Wearable App Testing
PPTX
Choosing the Best Open Source Test Automation Tool for You
PDF
Automating the API Product Lifecycle
PPTX
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
PPTX
Cross Platform Mobile Technologies
PPTX
React vs angular what to choose for your app
PPTX
Build mobile back-end (Restful API) by using Microsoft Azure Functions
PDF
Memulai Karir menjadi iOS Developer - Gilang ramadhan (Academy Content Writer...
PPTX
[Android] DI in multimodule application
PDF
Automated UI Testing Frameworks
PDF
React Native: Is It Worth It? UA Mobile 2017.
PPTX
Microsoft app center
PPTX
Xp conf-tbd
PDF
~ilities Testing
PPTX
Mobile Automation Using Appium - vodQA Bangalore 2015
PPTX
Android studio&Gradle&Autotest
PDF
3x3: Speeding Up Mobile Releases
PPTX
Clean architecture on android
PDF
Modern Functional Test Automation Through Visual AI - webinar w/ Raja Rao
Meningkatkan SOC dan Reusabillity Kode dengan Duo DI - Sidiq Permana (CIO Nus...
ATAGTR2017 Wearable App Testing
Choosing the Best Open Source Test Automation Tool for You
Automating the API Product Lifecycle
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
Cross Platform Mobile Technologies
React vs angular what to choose for your app
Build mobile back-end (Restful API) by using Microsoft Azure Functions
Memulai Karir menjadi iOS Developer - Gilang ramadhan (Academy Content Writer...
[Android] DI in multimodule application
Automated UI Testing Frameworks
React Native: Is It Worth It? UA Mobile 2017.
Microsoft app center
Xp conf-tbd
~ilities Testing
Mobile Automation Using Appium - vodQA Bangalore 2015
Android studio&Gradle&Autotest
3x3: Speeding Up Mobile Releases
Clean architecture on android
Modern Functional Test Automation Through Visual AI - webinar w/ Raja Rao
Ad

Similar to Rendra Toro - Model View Presenter (20)

PDF
Model View Presenter
PDF
MVP Clean Architecture
PPTX
27th Hyderabad MuleSoft Meetup
PPTX
API LifeCycle Management
PPTX
SDLC and Software Process Models
DOC
Ashish Baraiya
DOCX
DOC
BuchiReddy 5+Years Resume
PPT
Soft lifecycle
PPTX
PPT
Il product development - 20 01 2011
PPTX
Prototyping
DOC
VINOD_6yrs
PPTX
prod-dev-management.pptx
DOC
Resumeupdated
PPT
Kelis king - software development life cycle (sdlc)
PPT
Kelis king - software development life cycle (sdlc)
PPTX
Software models
PDF
Accelerating tests with Cypress for a leaderboard platform
PDF
Java server faces
Model View Presenter
MVP Clean Architecture
27th Hyderabad MuleSoft Meetup
API LifeCycle Management
SDLC and Software Process Models
Ashish Baraiya
BuchiReddy 5+Years Resume
Soft lifecycle
Il product development - 20 01 2011
Prototyping
VINOD_6yrs
prod-dev-management.pptx
Resumeupdated
Kelis king - software development life cycle (sdlc)
Kelis king - software development life cycle (sdlc)
Software models
Accelerating tests with Cypress for a leaderboard platform
Java server faces
Ad

More from Dicoding (16)

PDF
ID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina Wardy
PDF
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
PDF
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
PDF
I/O Extended (GDG Bogor) - Andrew Kurniadi
PPTX
I/O Extended (GDG Bogor) - Sidiq Permana
PDF
I/O Extended (GDG Bogor) - Narenda Wicaksono
PPTX
Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)
PPTX
Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)
PDF
Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...
PPTX
Talkshow - Android N & I/O Update
PPTX
Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)
PDF
ID Developer Elite
PPTX
Yoza Aprilio - We must design
PPT
Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...
PPTX
High Performance NodeJS
PPTX
ID Android Dev Talk - Observer Pattern, Event Bus Usage, Firebase & Geofire
ID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina Wardy
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
I/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Sidiq Permana
I/O Extended (GDG Bogor) - Narenda Wicaksono
Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)
Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)
Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...
Talkshow - Android N & I/O Update
Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)
ID Developer Elite
Yoza Aprilio - We must design
Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...
High Performance NodeJS
ID Android Dev Talk - Observer Pattern, Event Bus Usage, Firebase & Geofire

Recently uploaded (20)

PPTX
Configure Apache Mutual Authentication
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
PDF
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
PPTX
Training Program for knowledge in solar cell and solar industry
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PPTX
Build Your First AI Agent with UiPath.pptx
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPTX
Module 1 Introduction to Web Programming .pptx
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Configure Apache Mutual Authentication
Data Virtualization in Action: Scaling APIs and Apps with FME
Early detection and classification of bone marrow changes in lumbar vertebrae...
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
Training Program for knowledge in solar cell and solar industry
Basics of Cloud Computing - Cloud Ecosystem
Co-training pseudo-labeling for text classification with support vector machi...
Consumable AI The What, Why & How for Small Teams.pdf
Rapid Prototyping: A lecture on prototyping techniques for interface design
Custom Battery Pack Design Considerations for Performance and Safety
The influence of sentiment analysis in enhancing early warning system model f...
Enhancing plagiarism detection using data pre-processing and machine learning...
Build Your First AI Agent with UiPath.pptx
Improvisation in detection of pomegranate leaf disease using transfer learni...
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
sbt 2.0: go big (Scala Days 2025 edition)
Module 1 Introduction to Web Programming .pptx
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION

Rendra Toro - Model View Presenter