Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pattern Oriented Design Chain of Responsibility From:Design Patterns Gamma. Johnson Helm. Vlissides (GoF) Present: F8906082 楊汝康 R9306008 徐德皓 R9306016 高稚翔.

Similar presentations


Presentation on theme: "Pattern Oriented Design Chain of Responsibility From:Design Patterns Gamma. Johnson Helm. Vlissides (GoF) Present: F8906082 楊汝康 R9306008 徐德皓 R9306016 高稚翔."— Presentation transcript:

1 Pattern Oriented Design Chain of Responsibility From:Design Patterns Gamma. Johnson Helm. Vlissides (GoF) Present: F8906082 楊汝康 R9306008 徐德皓 R9306016 高稚翔 R9306024 陳錫樺 R9306025 葉冠良 R9306029 謝漢風 2004/Dec/21

2 2 Outline Introduction 高稚翔 Structure Example 高稚翔 Object Example 葉冠良 Object Diagram 葉冠良 Non-software 葉冠良 UI Operation Example 陳錫樺 Interaction Diagram 陳錫樺 Successor 謝漢風 Class Diagram 謝漢風 Structure 徐德皓 Collaborations 徐德皓 Consequences of Behavior Patterns 楊汝康

3 2004/Dec/213 Introduction 3 majors  1.Creational Patterns Abstract factory 、 builder…. Etc.  2.Structural Patterns adapter 、 facade 、 proxy…etc.  3.Behavioral Patterns Chain of responsibility 、 command 、 memento…etc.

4 2004/Dec/214 Introduction Chain of Responsibility  Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.

5 2004/Dec/215 Structure Example if(/* 符合請求條件一 */) // 執行請求一 else if(/* 符合請求條件二 */) // 執行請求二 else // 執行預設請求或顯示訊息

6 2004/Dec/216 Object Example Consider a context-sensitive help facility for a graphical user interface. The user can obtain help information on any part of the interface just by clicking on it(F1)

7 2004/Dec/217 Object Diagram The goal is avoid the coupling

8 2004/Dec/218 Non-software Domia n Domain Domia n Domain Host A

9 2004/Dec/219 Interaction Diagram Neither aPrintButtom nor aPrintDialog handles the request; it stops at anApplication, which can handle it or ignore it.

10 2004/Dec/2110 UI Operation Example

11 2004/Dec/2111 UI Operation Example

12 2004/Dec/2112 Successor To forward the request along the chain, and to ensure receivers remain implicit, each object on the chain shares a common interface for handling requests and for accessing its successor on the chain 123

13 2004/Dec/2113 Class Diagram Super class

14 2004/Dec/2114 Structure Handler  HelpHandler ConcreteHandler  PrintButtom, PrintDailog Client

15 2004/Dec/2115 Collaborations When a client issues a request, the request propagates along the chain until a ConcreteHandler object takes responsibility for handling it.

16 2004/Dec/2116 Consequences Has the following benefits and liabilities  Advantage Reduced coupling. Added flexibility in assigning responsibility to objects  disadvantage Receipt isn’t guaranteed

17 2004/Dec/2117 Consequences of Behavior Patterns Separate the sender receiver  Command  Observer  Mediator  Chain of Responsibility

18 2004/Dec/2118 End Any questions?


Download ppt "Pattern Oriented Design Chain of Responsibility From:Design Patterns Gamma. Johnson Helm. Vlissides (GoF) Present: F8906082 楊汝康 R9306008 徐德皓 R9306016 高稚翔."

Similar presentations


Ads by Google