kukooBlog

look to the master, follow the master, walk with the master, see through the master, become the master.

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  213 随笔 :: 0 文章 :: 285 评论 :: 0 Trackbacks

今天在阅读Martin Fowler的《Patterns of Enterprise Application Architecture》时,终于让我``澄清"了tier和layer的关系。 Martin的原话是:

``When people discuss layering, there's often some confusion over the terms layer and tier. Often the two are used as synonyms, but most people see tier as implying a physical separation. Client-server systems are often described as two-tier systems, and the separation is physical: The client is a desktop and the server is a server. I use layer to stress that you don't have to run the layers on different machines. A distinct layer of domain logic often runs on either a desktop or the database server. In this situation you have two nodes but three distinct layers. With a local database I can run all three layers on a single laptop, but there will still be three distinct layers.

我们平时一直说``多层"结构,常常混淆着使用tier或者layer这个词( N-tier或者N-layer一般是掺和着用的),Matin则非常清楚的区分了这两个词的用法: tier更多的是指物理上的层次关系,比如说Client/Server结构,是two-tier的,因为客户端在桌面机上,服务器则在远端的数据库服务器上。 layer则更多的指逻辑上的层,我们通常说的Java EE,应该是N-layer的,因为从逻辑上,Java EE里面有表现层,业务逻辑层和数据永久层,在物理上,这三层可以在不同的tier上(表现层在PC上,业务逻辑层在应用服务器上,数据永久层则在数据库服务器上),也可以在一个tier上,比如Martin说的,如果把数据库,应用服务器和浏览器都装在一台笔记本电脑上,那么,3-layer就是在1-tier上了。

因此,当我们以后谈论Java EE的多层体系时,应该更精确的使用layer这个词。

【关于Martin Fowler】
http://en.wikipedia.org/wiki/Martin_Fowler
http://martinfowler.com/

posted on 2006-08-31 15:20 kukooBlog 阅读(2018) 评论(0)  编辑  收藏 所属分类: Others

只有注册用户登录后才能发表评论。


网站导航: