1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MVCモデルのそれぞれの責務について

1
Last updated at Posted at 2026-10-06

MVCモデルとは

MVCモデルとは、ソフトウェアの設計モデルの一つで、機能を「Model」(モデル)、「View」(ビュー)、「Controller」(コントローラ)の三つの役割に分離して実装し、それらが連携して処理を進める方式。

【引用元】https://e-words.jp/w/MVC%E3%83%A2%E3%83%87%E3%83%AB.html

SpringBootを用いた開発でもこのアーキテクチャが使われる。

Model(モデル)

Controllerから受け取ったデータの処理、業務ルールを定める。

業務ルール
何を許可し、何を禁止するか等の規則。そのドメインに存在する決まり。

View(ビュー)

利用者に画面を表示する。
ex) html, react

Controller(コントローラー)

ブラウザからリクエストを受け取り、処理を依頼し応答に繋げる。

それぞれの関係性

ブラウザがControllerにリクエストデータを渡す。
↓
Controllerがリクエストから必要な値を取り出しModelに渡す。
↓
Modelが処理した結果をControllerに返す。
↓
ControllerがViewに処理結果を渡す。
↓
Viewが作ったhtml等をブラウザに渡す。
↓
ブラウザがそのHTMLを表示する。

レイヤードアーキテクチャとの関係性

MVCのModelに相当する部分を、
Service, Repository, Entity等に分けている。

レイヤードアーキテクチャ
アプリケーションを役割ごとの層に分ける設計手法。

所感

データが受け渡される順番的には「MVCモデル」というより「VCMモデル」だな~。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?