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
MVVM vs. MVP
Search
Dmytro Khmelenko
October 10, 2017
Programming
0
43
MVVM vs. MVP
Comparison architectures MVVM for iOS and MVP for Android
Dmytro Khmelenko
October 10, 2017
Tweet
Share
More Decks by Dmytro Khmelenko
See All by Dmytro Khmelenko
Best of login experience
dkhmelenko
0
110
Best of sign in experience @ Droidcon Lisbon
dkhmelenko
0
60
Red or Green? Let us test
dkhmelenko
0
39
A journey to smaller APK size
dkhmelenko
1
100
A journey to smaller apk size
dkhmelenko
0
54
How Git helps us with localization
dkhmelenko
0
93
Dagger.Android module
dkhmelenko
0
49
Unit testing
dkhmelenko
0
32
RxJava at Freeletics
dkhmelenko
0
76
Other Decks in Programming
See All in Programming
Native Federation: The Future of Micro Frontends in Angular
manfredsteyer
PRO
0
130
Elm Form Validation
bkuhlmann
0
520
Fast JSX: Don't clone props object #28768
yossydev
1
200
Try creating your own orderedmap
kazamori
1
260
Git Lint
bkuhlmann
4
760
スキーマ駆動開発による品質とスピードの両立 - 私達は何故、スキーマを書くのか
kentaroutakeda
0
180
PHPはいつから死んでいるかの調査
chiroruxx
2
420
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
2
210
Webアプリをできるだけコードを手書きしないで作ってみる
tomokusaba
2
190
slow types ってなんだろう?
karad
0
150
パフォーマンスを求めてDBに機能を寄せる戦略
aoyagikouhei
0
110
Code Reviews
bkuhlmann
4
900
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
56
9.3k
The Cult of Friendly URLs
andyhume
74
5.7k
Learning to Love Humans: Emotional Interface Design
aarron
267
39k
Teambox: Starting and Learning
jrom
128
8.4k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.7k
The Invisible Side of Design
smashingmag
294
49k
The Pragmatic Product Professional
lauravandoore
26
5.8k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
275
13k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
Build The Right Thing And Hit Your Dates
maggiecrowley
25
2k
Testing 201, or: Great Expectations
jmmastey
30
6.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
34
6.1k
Transcript
MVVM-C vs MVP Aydar Mukhametzyanov Dmytro Khmelenko
None
None
View Controller Model Model-View-Controller
Layout Activity View Controller Model Model-View-Controller
View Controller Model Model-View-Controller
UIViewController Model View Controller Model-View-Controller
Problems with MVC Activity/UIViewController is a “God” class Business logic
is mixed with UI Hard to reuse Hard to implement tests
Solution Model-View-Presenter Model-View-ViewModel (+Coordinator)
View Model (Interactor) Activity Layout Presenter MVP
Solution Model-View-Presenter Model-View-ViewModel (+Coordinator)
MVVM UIViewController Model View Controller
Model ViewModel View UIViewController MVVM
Model ViewModel View UIViewController UIView MVVM Navigation?
MVVM stack Model ViewModel View Coordinator MVVM-C
MVVM stack Coordinator MVVM stack MVVM stack MVVM-C
MVVM stack MVVM stack MVVM stack MVVM stack Coordinator Coordinator
MVVM-C
View Model (Interactor) Activity Layout Presenter MVVM vs MVP Model
ViewModel View UIViewController UIView
• Provides data to Presenter/ViewModel • Processes data (networking, persistence)
Model (Interactor) Responsibilities
Responsibilities • Draws UI with provided data • Notifies Presenter/ViewModel
about user actions View
• Handles user actions from View • Gets data from
Model • Updates data in Model • Business logic • Provides updated/processed data to View Presenter/ViewModel Responsibilities ——————————————————— • Communicates with Coordinator
• Handle navigation • Build the MVVM stacks Coordinator Responsibilities
Same thing, different names?
Bindings View ViewModel Owns Observes by Reactive approach
Simulate bindings View ViewModel Owns Notifies To be continued… …with
Reactive approach?
Business logic is decoupled from UI Easy to maintain Easy
to test Easy to reuse components MVP/MVVM-C advantages
Thank you! Questions