Model View Presenter for Android
21
Model View Presenter for Android
-
Upload
shinnosuke-kugimiya -
Category
Engineering
-
view
2.959 -
download
7
Transcript of Model View Presenter for Android
ドメイン層
プレゼンテーション層
Presenter
Model
View
タッチなどのイベント
移譲
然るべき Modelのinterfaceをcall
ModelからのfeedbackはObserverPatterを用いて、View or Presenterへ通知するか
呼び出したPresenterにCallbackで返却するかのどちらでも良いと思う。
セオリーは前者だけど、githubのソースとか見ると後者の方が多い感じ。
return
return値をもとに
Viewを操作
android best practicesでも activityとfragmentって Controllerでもあるし
Viewでもあるよねって言ってる。
https://github.com/futurice/android-best-practices
ドメイン層
プレゼンテーション層
Controller
Model
View
タッチなどのイベント
Activityが この位置に居るので Model関連の処理を
Activityに書く事になる
Model View Controller
Activity
ドメイン層
プレゼンテーション層
Presenter
Model
View
タッチなどのイベント
Activityが この位置に居るので Modelと疎になり 書くべき事が減る
移譲
Model View Presenter
Activity