Model-View-Presenter は、UI レベルで動作とロジックの構造を定義するアーキテクチャ パターンです。MVP は、バックエンド サービスやビジネス レイヤーとの対話などのプレゼンテーションのロジックを、ボタンやインターフェイス コンポーネントを表示するメカニズムから分離します。
パッシブ ビューは、Model-View-Presenter パターンのサブセットです。
基本モデル ビュー プレゼンター図
外側から見ると、パッシブ ビューのアーキテクチャは次のようになります。
UI – The User Interface reflects what is going on beneath it by implementing one or more View interfaces
Presenter – The Presenter receives interactions from the UI or Model and updates the Views it is attached to
Model – The model is a facade or black box in our diagram, behind which is a business logic layer and data layer
フラット アーキテクチャでは、インターフェイスからデータを収集し、ビジネスとデータの検証を行ってから、ストアド プロシージャまたはインライン SQL を使用してデータベースに直接保存します。データ アクセス レイヤー (またはエンティティ フレームワークのようなデータ モデル) を定義することで、アプリケーションは、アプリケーションにとって意味があり、一貫して格納および取得される、まとまりのある定義済みオブジェクトを操作できるようになります。ビジネス ロジック層を定義することで、ビジネスと一貫性があり、アプリケーション内で一貫した方法で、アプリケーション内のエンティティを操作するビジネス ルールを一元化できるため、ビジネス フローを変更するときに発生するリスクを最小限に抑えることができます。
サンプル アプリケーションには、いくつかの機能要件と非機能要件があります。
Functional – Display product number, name, list price, and available quantity in tabular format
Functional – Provide a basic search input and button to search product names
Non-Functional – Implement an M-V-P pattern – Obviously the purpose of this whole exercise
Non-Functional – Use a simple model stack that can be easily replaced with a Service-Oriented one at a later time
Non-Functional – Build with the idea that we will later create a Silverlight or WPF front-end
Non-Functional – Make pretty pictures for article