Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
MVP on Android: why do you need it?
Search
Stan Kocken
May 02, 2016
Programming
190
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
More Decks by Stan Kocken
See All by Stan Kocken
Remote Control your App
stankocken
3
500
Unit Test your code, even your UI
stankocken
1
310
EfficientAdapter
stankocken
1
120
Other Decks in Programming
See All in Programming
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
490
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
170
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
16
3.5k
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
190
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
140
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
330
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
170
OSINT for SRE: 学術論文とポストモーテムから探る システム障害の共通パターン / SRE NEXT 2026
tomoyk
1
3.7k
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
0
210
共通化で考えるべきは、実装より公開する型だった
codeegg
0
240
Creating Composable Callables in Contemporary C++
rollbear
0
210
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
130
Featured
See All Featured
How to build a perfect <img>
jonoalderson
1
5.8k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
360
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
370
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.6k
Raft: Consensus for Rubyists
vanstee
141
7.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Done Done
chrislema
186
16k
Google's AI Overviews - The New Search
badams
0
1.1k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
470
Code Reviewing Like a Champion
maltzj
528
40k
Transcript
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