Three-tier与MVC的不同


先说Three-tier。简单点说,

                  客户机---应用服务器-----数据服务器

典型的情况下有多个db服务器和多个客户端。应用服务器也可以有多个。应用服务器指 对客户端的请求进行分析,平衡,再将其分配给db服务器。对db服务器返回的结果集分析,平衡,发送至不同的客户端。

一个最简单的例子:
  client1,client2发出两个相同的select语句到应用服务器。应用服务器发现两个请求相同,向数据库服务器select一次,得到结果集,发给两个客户端。
  在没有应用服务器的情况下,数据库须被执行两次select。


对网络应用而言,可以说成下面的结构:

   database 服务器----
                  |
                   -----Web服务器——--
                                     |
                                      -------客户端浏览器
好处:
1、减轻database 服务负担;
2、瘦客户;
   ......


再说MVC。

MVC是遵循了关注点分离的原则,C和V对M是松耦合的。

Today, MVC and similar MVP are Separation of Concerns design patterns that apply exclusively to the presentation layer of a larger system. In simple scenarios MVC may represent the primary design of a system, reaching directly into the database; however, in most scenarios the C (Controller) and M (Model) in MVC have a loose dependency on either a Service or Data layer/tier.


最后说说两者的不同。

Three-tier的各方是线性连接的。

A fundamental rule in a three tier architecture is the client tier never communicates directly with the data tier; in a three-tier model all communication must pass through the middle tier. Conceptually the three-tier architecture is linear.

但是MVC的各方的连接方式是三角型的。

However, the MVC architecture is triangular: the view sends updates to the controller, the controller updates the model, and the view gets updated directly from the model.


两者如何联系起来呢?

MVC中的V和C很可能就是Three-Tier的client端;这样一来,对一个大的系统而言,它是three-tier的三层架构,而它的client端的框架可以是MVC的.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值