Upload
mahbub1669
View
217
Download
0
Embed Size (px)
Citation preview
8/10/2019 ASS15POSA
1/30
Object Interaction
Adaptation and ExtensionBuschmann et al.: POSA 4, Wiley, 2007
8/10/2019 ASS15POSA
2/30
Observer
Object Interaction
8/10/2019 ASS15POSA
3/30
Mediator 1/2
Object Interaction
8/10/2019 ASS15POSA
4/30
Mediator 2/2
director->WidgedChanged(this)
DialogDirector
ShowDialog()
CraeteWidgets()
WidgedChanged( : Widged)
Widget
Changed()
Mediator
ListBox
GetSelection()
EntryField
SetText()
Button
FontDialogDirector
CreateWidgets()
WidgedChanged( : Widged)
GAMMA et al.:Design Patterns, Elements of Reusable Object-Oriented Software,Addison Wessley Longmann, 1998
8/10/2019 ASS15POSA
5/30
Command 1/2
Object Interaction
8/10/2019 ASS15POSA
6/30
Command 2/2
+Add(inout Document)
Application
+Add(in MenuItem)
Menu
+Clicked()
MenuItem
+Execute()
Command
+Open()
+Close()
+Cut()
+Copy()
+Paste()
Document
Command -> Execute ()
-End1
1
-End2
*
-End3
1
-End4
*
-End5
1
-End6
*
+Execute()+AskUser()
OpenCommand
+Execute()
PasteCommand
+Execute()
ConcreteCommand
+Execute()
MacroCommand
1
*
for all c in command
c->Execute();
Client
Receiver
Invoker
name = AskUser();
doc = new Document(name);
application->Add(doc);
doc->Open();
document->Paste();
receiver->Action();
*
*
GAMMA et al.:Design Patterns, Elements of Reusable Object-Oriented Software,Addison Wessley Longmann, 1998
8/10/2019 ASS15POSA
7/30
Memento
Object Interaction
8/10/2019 ASS15POSA
8/30
Data Transfer Object
Object Interaction
8/10/2019 ASS15POSA
9/30
Message
Object Interaction
8/10/2019 ASS15POSA
10/30
Bridge 1/2
Adaptation and Extension
Several different implementation (platform specific, runtime decision,).
Interface abstraction refinement.
Separate implementor hierarchy, providing various implementation.
8/10/2019 ASS15POSA
11/30
Bridge 2/2
GAMMA et al.:Design Patterns, Elements of Reusable Object-Oriented Software,Addison Wessley Longmann, 1998
8/10/2019 ASS15POSA
12/30
8/10/2019 ASS15POSA
13/30
Object Adapter 2/2
GAMMA et al.:Design Patterns, Elements of Reusable Object-Oriented Software,Addison Wessley Longmann, 1998
8/10/2019 ASS15POSA
14/30
Chain of Responsibility
Adaptation and Extension
8/10/2019 ASS15POSA
15/30
Interpreter 1/3
Adaptation and Extension
8/10/2019 ASS15POSA
16/30
Interpreter 1/3
GAMMA et al.:Design Patterns, Elements of Reusable Object-Oriented Software,Addison Wessley Longmann, 1998
8/10/2019 ASS15POSA
17/30
Interpreter 1/3
GAMMA et al.:Design Patterns, Elements of Reusable Object-Oriented Software,Addison Wessley Longmann, 1998
8/10/2019 ASS15POSA
18/30
Interceptor
Adaptation and Extension
Registering out of-band service extensions
via predefined callback interfaces.
Trigger when specific events occur.
8/10/2019 ASS15POSA
19/30
Visitor 1/4
Adaptation and Extension
8/10/2019 ASS15POSA
20/30
Visitor 2/4
8/10/2019 ASS15POSA
21/30
Visitor 3/4
8/10/2019 ASS15POSA
22/30
Visitor 4/4
8/10/2019 ASS15POSA
23/30
Decorator 1/3
Adaptation and Extension
8/10/2019 ASS15POSA
24/30
Decorator 2/3
window->SetContents(
new BorderDecorator(
new ScrollDecorator(textView), 1
)
8/10/2019 ASS15POSA
25/30
Decorator 3/3
8/10/2019 ASS15POSA
26/30
Execute-Around Object
Adaptation and Extension
Constructor and destructor to perform pre- and post-sequence actions.
8/10/2019 ASS15POSA
27/30
Template Method
Adaptation and Extension
8/10/2019 ASS15POSA
28/30
Strategy
Adaptation and Extension
8/10/2019 ASS15POSA
29/30
Null Object
Napojenie DB.
Priehradky platov zamestnancov.
Adaptation and Extension
8/10/2019 ASS15POSA
30/30
Wrapper Facade
Adaptation and Extension
Avoid accessing low-level function-based APIs directly.
Faade interface partitioning,