哪个MVC图是正确的? (网络应用) [英] Which MVC Diagram is Correct? (Web app)

查看:102
本文介绍了哪个MVC图是正确的? (网络应用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个MVC图是正确的?每个都有不同的箭头...



图1





图2





图5



http://www.shopno-dinga。 com / dustbin / mvc.png

解决方案

他们都是。



MVC是一个模糊的模式。



我对MVC的观点是:



控制器



Object具有模型集合,并具有查看和编辑模型的方法。它与模型进行交谈,并返回具有应用模型的视图实例。



查看



模型

p>

封装数据。有返回状态和更改状态的方法。

  //控制器
导入视图

类控制器
私人模型

//查看
import模型

类查看

//模型
模型

模型不需要知道有关View / Controller的任何内容。视图需要知道模型的定义。控制器需要自己的模型,需要知道视图的定义。



您可以更紧密地联系他们,这是可选的。


Which MVC diagram is correct? Each have different arrows...

Diagram 1

Diagram 2

http://blog.stannard.net.au/blog/media/simple-mvc-framework/mvc.gif

Diagram 3

Diagram 4

http://java.sun.com/blueprints/patterns/images/mvc-structure-generic.gif

Diagram 5

http://www.shopno-dinga.com/dustbin/mvc.png

解决方案

They all are.

MVC is a vague pattern.

My view on MVC is that :

Controller

Object has a collection of models and has methods for viewing and editing the models. It talks to Models and returns instances of Views with models applied on them.

View

Has the definition of a model attached to it and is just a set of functionality to display a specific model.

Model

Encapsulates data. Has methods for returning state and changing state.

//Controller
import Views

class Controller
  private Models

//View
import Model

class View

//Model
class Model

A Model doesn't need to know anything about the View / Controller. A View needs to know the definition of a Model. A controller needs to own Models and needs to know definitions of Views.

You can couple them more tightly, that is optional.

这篇关于哪个MVC图是正确的? (网络应用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆