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.

DjangoをMVCで開発するメリットについて

Posted at

Djangoフレームワークについて

通常、Djangoフレームワークは、
スクリーンショット 2023-03-19 11.22.33.png
上記のような「MVT」のアーキテクチャとなっております。
小規模なアプリケーションの開発の場合は特に問題はありませんが、大規模なサーバーサイドを開発する場合は、viewに
・RESTゲートウェイ
・業務ロジック
・DBとのIn/Out
これらの処理が一点に混在してしまうことで、viewが太り、保守性が悪くなってしまいます。

回避方法

MVTをMVCに変換することで、解決をすることができます。
具体的には、
スクリーンショット 2023-03-19 11.30.50.png
上記のようなアーキテクチャになります。
これは、JavaのMVCアーキテクチャを参考にしています。

最初太っていたviewを、RESTゲートウェイの機能のみに集中させます。
業務ロジックは、Application層のServiceImplに移動、
DBとのIn/Outとそれに付随する処理は、RepositoryImplに移動させます。

このように構築することで、役割を分散させることができ、viewが太ってしまうことを防ぐことができます。

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?