【文章內(nèi)容簡介】
d – Elaboration on clientserver C/S模式的擴展 – Aggregation into runtime strata 運行時層的結(jié)合 – Usually small number of tiers 通常只有少量的層 ? Components (later) – Multiple interfaces – Special protocols for dynamic reconfiguration 支持動態(tài)配置的專門協(xié)議 20 OSI參考模型 21 22 The layered architectural pattern ? Problem: This pattern is suitable for applications that involve distinct classes of services that can be arranged hierarchically. Often there are layers for basic systemlevel services, for utilities appropriate to many applications, and for specific tasks of the application. ? Context: Frequently, each class of service is assigned to a layer and several different patterns are used to refine the various layers. Layers are most often used at the higher levels of design, using different patterns to refine the layers. ? Solution: – System model: hierarchy of opaque(不透明的) layers – Components: usually posites。 posites are most often collections of procedures – Connectors: depends on structure of ponents。 often procedure calls under restricted visibility, might also be client/server – Control structure: single thread 24 層次風(fēng)格特點 ? 每層為上一層提供服務(wù),使用下一層的服務(wù),只能見到與自己 鄰接 的層 – 適當(dāng)時候 (迫不得已時 ),可以允許一定的越層操作 ? 大的問題分解為若干個漸進(jìn)的小問題,逐步解決,隱藏了很多復(fù)雜度 ? 修改一層,最多影響兩層,而通常只能影響上層。若層之間接口穩(wěn)固,則不會造成其他影響 ? 上層必須知道下層的身份,不能調(diào)整層次之間的順序 ? 層層相調(diào),影響性能 26 Client/Server 服 務(wù) 器客 戶客 戶客 戶客 戶客 戶客 戶網(wǎng)絡(luò)網(wǎng) 絡(luò)???? 服務(wù)器 客戶 客戶 客戶 客戶 客戶 Local Loopback 27 Client/Server Style ? 兩層 C/S結(jié)構(gòu) ? 三層 C/S結(jié)構(gòu) ? B/S結(jié)構(gòu)(瀏覽器 /服務(wù)器風(fēng)格) 28 兩層 Client/Server Workstations包含顯示層與業(yè)務(wù)層, Server只有數(shù)據(jù) 29 兩層 Client/Server ? C/S是 基于資源不對等 ,且為實現(xiàn)共享而提出的, 20世紀(jì) 90年代成熟起來 ? C/S有三個主要組成部分:數(shù)據(jù)庫服務(wù)器、客戶端和網(wǎng)絡(luò) ? 服務(wù)器(后臺)負(fù)責(zé)數(shù)據(jù)管理,客戶端(前臺)完成與用戶的交互任務(wù)?!?胖客戶端,瘦服務(wù)器 ” ? 缺點: – 對客戶端軟硬件配置要求較高,客戶端臃腫 – 客戶端程序設(shè)計復(fù)雜 – 數(shù)據(jù)安全性不好。 客戶端程序可以直接訪問數(shù)據(jù)庫服務(wù)器 。 – 信息內(nèi)容和形式單一 – 用戶界面風(fēng)格不一,使用繁雜,不利用推廣使用 – 軟件維護(hù)與升級困難。每個客戶機上的軟件都需要維護(hù) 30 三層 Client/Server ? ClientApplicationServer ? 與二層 C/S結(jié)構(gòu)相比,增加了一個 應(yīng)用服務(wù)器 。 ? 整個 應(yīng)用邏輯 駐留在應(yīng)用服務(wù)器上,只有表示層存在于客戶機上(“ 瘦客戶端 ”) ? 應(yīng)用功能分為 表示層、功能層、數(shù)據(jù)層 三層 – 表示層是應(yīng)用的用戶接口部分。通常使用圖形用戶界面 – 功能層是應(yīng)用的主體,實現(xiàn)具體的業(yè)務(wù)處理邏輯 – 數(shù)據(jù)層是數(shù)據(jù)庫管理系統(tǒng)。 – 以上三層邏輯上獨立。 – 通常只有表示層配置在客戶端中 思考:“瘦客戶端”的三層 C/S有何優(yōu)缺點? 31 33 B/S ? B/S是三層 C/S的特例 ? 客戶端為 瀏覽器 – 為增強功能,往往還需要安裝 flash、 jvm及一些專用插件 – 使用標(biāo)準(zhǔn) /協(xié)議 – 要考慮瀏覽器兼容的問題 ? 通常只能“ 拉 ”,不能“ 推 ” ? 客戶之間的通信只能通過服務(wù)器中轉(zhuǎn) ? 安全性 較難控制( SQL注入攻擊等) ? 數(shù)據(jù)查詢等響應(yīng)速度低于 C/S體系結(jié)構(gòu) ? 服務(wù)器的負(fù)荷大,客戶機的資源浪費 – 用 RIA等技術(shù)解決,主流瀏覽器也對硬件逐步利用 到底應(yīng)把主要的計算量放到客戶機還是服務(wù)器? 34 Software Architecture Style: Data Centered / Shared Data 35 36 Shared Information Systems ? Style represents a large variety of systems 這種風(fēng)格