kukooBlog

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

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            213 隨筆 :: 0 文章 :: 285 評(píng)論 :: 0 Trackbacks

          今天在閱讀Martin Fowler的《Patterns of Enterprise Application Architecture》時(shí),終于讓我``澄清"了tier和layer的關(guān)系。 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.

          我們平時(shí)一直說(shuō)``多層"結(jié)構(gòu),常常混淆著使用tier或者layer這個(gè)詞( N-tier或者N-layer一般是摻和著用的),Matin則非常清楚的區(qū)分了這兩個(gè)詞的用法: tier更多的是指物理上的層次關(guān)系,比如說(shuō)Client/Server結(jié)構(gòu),是two-tier的,因?yàn)榭蛻舳嗽谧烂鏅C(jī)上,服務(wù)器則在遠(yuǎn)端的數(shù)據(jù)庫(kù)服務(wù)器上。 layer則更多的指邏輯上的層,我們通常說(shuō)的Java EE,應(yīng)該是N-layer的,因?yàn)閺倪壿嬌希琂ava EE里面有表現(xiàn)層,業(yè)務(wù)邏輯層和數(shù)據(jù)永久層,在物理上,這三層可以在不同的tier上(表現(xiàn)層在PC上,業(yè)務(wù)邏輯層在應(yīng)用服務(wù)器上,數(shù)據(jù)永久層則在數(shù)據(jù)庫(kù)服務(wù)器上),也可以在一個(gè)tier上,比如Martin說(shuō)的,如果把數(shù)據(jù)庫(kù),應(yīng)用服務(wù)器和瀏覽器都裝在一臺(tái)筆記本電腦上,那么,3-layer就是在1-tier上了。

          因此,當(dāng)我們以后談?wù)揓ava EE的多層體系時(shí),應(yīng)該更精確的使用layer這個(gè)詞。

          【關(guān)于Martin Fowler】
          http://en.wikipedia.org/wiki/Martin_Fowler
          http://martinfowler.com/

          posted on 2006-08-31 15:20 kukooBlog 閱讀(2314) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Others
          主站蜘蛛池模板: 连平县| 淮阳县| 乌苏市| 郁南县| 翁源县| 新野县| 红桥区| 安远县| 白沙| 永城市| 息烽县| 延庆县| 红桥区| 平泉县| 西乌| 本溪| 青铜峡市| 江华| 卓尼县| 金塔县| 渭南市| 怀集县| 兰溪市| 阳泉市| 江安县| 濮阳县| 连云港市| 平山县| 封开县| 盖州市| 周至县| 天台县| 南和县| 洮南市| 沂南县| 金沙县| 宾川县| 平谷区| 秦皇岛市| 襄城县| 永城市|