Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
MVP on Android: why do you need it?
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Stan Kocken
May 02, 2016
Programming
210
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
MVP on Android: why do you need it?
Stan Kocken
May 02, 2016
Transcript
25 slides
MVP: why do you need it? @stan_kocken
Join our team! dashlane.com/jobs Never forget another password Editor Choice
Top Developer 4.5/5 - 1M+ downloads
MVP: why do you need it?
Activity
BaseActivity: 1600+ lines A base activity that handles common functionality
in the app. This includes the navigation drawer, login and authentication, Action Bar tweaks, amongst others.
God Object
Activity
Activity/Fragments Usually contain: - actions on View - handle clicks
- read/write in database / SharePreference - network calls - …
Activity/Fragments Very hard to: - read - test - refactor
- reuse code - …
Separation of Concerns
Architecture MVP Model View Presenter state-change events updates view update
model user events
Architecture MVP: in Android, my way Model View Presenter
Architecture MVP: in Android, my way Model: access data store
state View Presenter
Architecture MVP: in Android, my way Model: access data store
state View Presenter: present data to UI
Architecture MVP: in Android, my way Model: access data store
state View: touch Android View no business logic Presenter: present data to UI
Architecture MVP: in Android, my way View: touch Android View
no business logic Presenter: present data to UI Model: DataProvider access data store state
Architecture MVP: in Android, my way Model: DataProvider access data
store state View: ViewProxy touch Android View no business logic Presenter: present data to UI
Presenter DataProvider ViewProxy Activity View Strong Reference Weak Reference Other
“Strong” Reference on DataProvider, Presenter or ViewProxy forbidden. Use WeakReference. Architecture MVP: in Android, my way
Example
DataProvider Presenter ViewProxy Creation refreshBoard() getGameBoard() setBoxValue( int x, int
y, int boxType);
DataProvider Presenter ViewProxy User click box onSelectBox(int x, int y)
play(int x, int y) refreshBoard() …
Definition public interface BoardDef { interface IPresenter extends BaseDef.IPresenter
{ void refreshBoard(); void onSelectBox(int x, int y); } interface IDataProvider extends BaseDef.IDataProvider { GameBoard getGameBoard(); void play(int x, int y); } interface IView extends BaseDef.IView { void setBoxValue(int x, int y, int boxType); } }
Test the UI Android stuffs TextView ImageView … View Proxy
Already Tested by framework team
Test the UI View Proxy Mock Mock Mock
@stan_kocken Presentation pattern: github.com/StanKocken/Presentation TicTacToe Example: github.com/StanKocken/TicTacToe
More Decks by Stan Kocken
See All by Stan Kocken
Remote Control your App
stankocken
3
510
Unit Test your code, even your UI
stankocken
1
340
EfficientAdapter
stankocken
1
120
Other Decks in Programming
See All in Programming
小さなアプリを作って公開するまで
onozaty
0
170
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3.2k
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
2
120
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.5k
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
230
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
170
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
130
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
210
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
330
Spec-driven Development with AI
simas
PRO
0
2.3k
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
350
SFCで実現する病院・医療システムの動的組み立て式UI
koukimiura
1
180
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
520
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380
For a Future-Friendly Web
brad_frost
184
11k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
980
Site-Speed That Sticks
csswizardry
13
1.6k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
300
Building the Perfect Custom Keyboard
takai
2
950
Tell your own story through comics
letsgokoyo
1
1.1k
Crafting Experiences
bethany
1
430
Evolving SEO for Evolving Search Engines
ryanjones
0
360
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
69k