0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ModelについてViewModelが行うこと

Last updated at Posted at 2023-08-25

は、イベントに対する反応と戻り値のないメソッドの呼び出ししかない

だけではない。

設計による。
MVVMとして決まった方式があるわけではない。

MVCの場合
C=>M=>Vの方向にデータが流れるので
MからCへ戻るデータはない。

MVVMでは VM<=>Mとデータは双方向に流れるので決まりはない。

戻り値を用いてVIewModelで処理をしていけないという決まりもない。

MVCのMとMVVMのMは違う。

戻り値をもらうと依存してしまうという誤解

ViewModelは元からModelに依存しているので戻り値もらっても変わらない。

戻り値もらうと密結合になるという誤解

ならない。

MVVMの単一方向データフローであるという誤解

 V->VM->M

と依存方向が一方向なだけでデータが一方向ではない。データは双方向

非同期処理は一方法だけではない

・async/await
・コールバック
・イベント通知

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?