freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

第11講架構與其他模式-在線瀏覽

2024-12-01 16:41本頁面
  

【正文】 ... ... Register makeNewSale() enterItem() ... : Cashier makeNewSale() enterItem() endSale() makeNewSale() enterItem() endSale() enterItem(id, quantity) :System : Cashier endSale() description, total * [more items] makeNewSale() the system operations handled by the system in an SSD represent the operation calls on the Application or Domain layer from the Presentation layer Shanghai Jiaotong University 外部資源或者外部數(shù)據(jù)庫層的表示 2020/11/4 29 Domain(s) Technical Services Foundation Inventory Persistence Naming and Directory Services Web AppFramework Technical Services POS Inventory Domain(s) Foundation Worse mixes logical and implementation views Better a logical view a logical representation of the need for data or services related to these subdomains, abstracting implementation decisions such as a database. Novell LDAP UML notation : A UML ponent, or physical part of the system. UML notation : A physical database in the UML. Shanghai Jiaotong University 采用觀察器進行向上協(xié)同 2020/11/4 30 : Domain:: Sales:: Register :Cashier : Presentation:: Swing:: Process SaleFrame enterItem (id, qty) ... enterItem (id, qty) s : Domain:: Sales:: Sale makeLineItem(spec, qty) Collaboration from the lower layers to the Presentation layer is usually via the Observer (PublishSubscribe) pattern. The Sale object has registered subscribers that are PropertyListeners. One happens to be a Swing GUI JFrame, but the Sale does not know this object as a GUI JFrame, but only as a PropertyListener. onPropertyEvent(s, , total) PropertyListener ... Shanghai Jiaotong University 禁忌 ?某些情況下,增加層次將引入性能問題 ?并不是適用于所有問題 ? For example, Pipes and Filters 2020/11/4 31 Shanghai Jiaotong University 好處 ?關注點分離 Separation of concerns降低耦合和依賴,提高內聚,增加重用性和清晰度 ?相關的復雜性被封裝和分解 ?低層包含了可重用的功能 ?某些層可以分布 ?團隊開發(fā) 2020/11/4 32 Shanghai Jiaotong University 經(jīng)典的三層架構 ? Interface ? Application Logic ? Storage C a l c u l a t e t a x e sI n te r fa c eA p p li c a ti o nL o g icA u t h o r i z ep a y m e n t sS t o ra g eD a t a b a s e2020/11/4 33 Shanghai Jiaotong University 部署 2020/11/4 34 calculate taxes Application Logic Interface calculate taxes Application Logic Interface classic 3tier architecture deployed on 2 nodes: thicker client classic 3tier architecture deployed on 3 nodes: thiner client UML notation: a node. This is a processing resource such as a puter. Shanghai Jiaotong University 模型視圖分離原則 ?模型 : 領域層對象 ?視圖 : 表現(xiàn)對象 , 例如 windows, applets and reports ?模型(領域)對象不能夠直接知道視圖(表現(xiàn))對象 2020/11/4 35 Shanghai Jiaotong University 模型視圖分離和“向上”通信 ? 從上面拉 Pullfromabove ? 從下面推 Pushfrombelow ? 觀察者模式 Observer Pattern: making the GUI object appears as an object implements an interface such as PropertyListener ? UI外觀對象 Presentation fa231。 ? 對輸出機制的變化實現(xiàn)了防止變異 ? 一致的錯誤匯報風格 ? 集中控制公共的錯誤通知策略 ? 性能也有所改進 2020/11/4 49 Shanghai Jiaotong University 處理異常 2020/11/4 50 : DBProducts Adapter : Local Products IProductsAdapter :ProductCatalog ps := getSpec(id) :Register enterItem(id, qty) :ProcessSale Frame exception ProductInfoUnavailableException() singleton :ErrorDialog notify(message, exception) ps := getSpec(id) ps := getSpec(id) continued singleton :ErrorDialog notify (message, exception) * : notify(message) : Object : Object INotifier GUI dialog box text console dialog speech dialog singleton :Log log(exception) IProductsAdapter Convert Exception pattern Error Dialog pattern Centralized Error Logging pattern Shanghai Jiaotong University (5)代理 (GoF) ?問題 : 不希望或不可能直接訪問真正的主題對象時,應該如何 ?解決方案 : 通過代理對象增加一層間接性,代理對象實現(xiàn)與主題對象相同的接口,并且負責控制和增強對主題對象的訪問 2020/11/4 51 Shanghai Jiaotong University Proxy 結構 2020/11/4 52 interface ISubjectInterface foo() RealSubject foo() { ... preprocessing () ... postprocessing } Client subject : ISubjectInterface doBar() 1 1 1 1 Proxy realSubject : ISubjectInterface foo() { ... whatever () ... whatever } subject actually references an instance of Proxy, not RealSubject realSubject will actually reference an instance of RealSubject Shanghai Jiaotong University (6)抽象工廠 (GoF) ?可能需要與多種不同的物理設備打交道 ,… ?這些設備可能來自不同的廠商,如 IBM, Epson, 它們的驅動十分類似 (Java Classes) ?問題 : 如何創(chuàng)建實現(xiàn)相同接口的相關類的族 ? ?解決方案 : 定義一個公共接口 (abstract factory), 具體的工廠繼承它 2020/11/4 53 Shanghai Jiaotong University Abstract factory 2020/11/4 54 interface IJavaPOSDevicesFactory getNewCashDrawer() : getNewCoinDispenser() : ... IBMJavaPOSDevicesFactory ... getNewCashDrawer() : getNewCoinDispenser() : ... { return new () } interface isDrawerOpened() ... NCRJavaPOSDevicesFactory ... getNewCashDrawer() : getNewCoinDispenser() : ... { return new () } this is the Abstract Factoryan interface for creating a family of related objects isDrawerOpened() ... isDrawerOpened() ... Shanghai Jiaotong University (7)Do it myself ?我是對實際對象的抽象,由我來完成這些通常由實際對象完成的事情 ?與信息專家模式相比較 (Text Object does spellchecking), 多態(tài) (Circle Object draws itself) 2020/11/4 55 Shanghai Jiaotong University Do it myself (polymorphism) 2020/11/4 56 Payment amount authorize() CashPayment authorize() CreditPayment authorize() CheckPayment authorize() DebitPayment authorize() By Polymorphism, each payment type should authorize itself. This is also in the spirit of Do it Myself (Coad) Shanghai Jiaotong University ?采用模式來設計持久化框架 ?某些與數(shù)據(jù)處理相關的模式 : ?將對象表示為表 ?Representing object relationships as Tables ?對象標識 ?數(shù)據(jù)庫映射器 Database Mapper/Broker ?緩存管理 Cache management ?新的 GoF 模式 : Template, State, Command, Virtual Proxy 2020/11/4 57
點擊復制文檔內容
教學課件相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1