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
46
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
68
Red or Green? Let us test
dkhmelenko
0
41
A journey to smaller APK size
dkhmelenko
1
110
A journey to smaller apk size
dkhmelenko
0
59
How Git helps us with localization
dkhmelenko
0
97
Dagger.Android module
dkhmelenko
0
61
Unit testing
dkhmelenko
0
35
RxJava at Freeletics
dkhmelenko
0
82
Other Decks in Programming
See All in Programming
Vapor Revolution
kazupon
1
180
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
6
2k
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.3k
Better Code Design in PHP
afilina
PRO
0
130
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.8k
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
169
14k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Docker and Python
trallard
40
3.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
A better future with KSS
kneath
238
17k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
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