1
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?

MVVMってなに?。自分なりにまとめておく

Posted at

はじめに

最近、MAUIについて調べていたところ、「MAUIはMVVMが推奨されている」という情報をよく見かけました。「MVVM」という単語になじみがなかったので、MVVMとはどんなものなのか、いろいろな説明記事を読んで調べてみることにしました。ここでは、その中でなんとなくイメージできたことを自分なりにまとめておきたいと思います。

MVVMは「ソフトウェアの設計思想」のひとつ

MVVMは「ソフトウェアの設計思想」をあらわす単語のようです。MVVMではソフトウェアをModel、View、ViewModelで構成します。

Model データを保持
View 見える部分。UI
ViewModel ModelとViewの橋渡し

MVVMはUIとデータ構造を分離したデザインパターン。

MVVMの特徴

私が感じた一番の特徴は、データバインディングです。
「UIに名前をつけて、裏側がそれを参照し、そのUIに値を挿入する」
という構造ではなく、MVVMでは、
「View側からViewModelにBindingし、ViewModelの変数がそのまま表示される」
という構造です。

おわりに

MVVMについて調べる前は、「なんだか独特なコードの書き方をするな」と思っていましたが、少しだけわかった気がします。

1
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
1
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?