Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Object Interaction

Adaptation and Extension


Buschmann et al.: POSA 4, Wiley, 2007

Observer

Object Interaction

Mediator 1/2

Object Interaction

Mediator 2/2
Widget
DialogDirector

Changed()

ShowDialog()
CraeteWidgets()
WidgedChanged( : Widged)

ListBox
GetSelection()

EntryField

Button

SetText()

FontDialogDirector
CreateWidgets()
WidgedChanged( : Widged)

director->WidgedChanged(this)

Mediator

GAMMA et al.: Design Patterns, Elements of Reusable Object-Oriented Software,


Addison Wessley Longmann, 1998

Command 1/2

Object Interaction

Command 2/2
Client

-End2
-End1

Application

-End3
-End4
Menu

-End5
-End6

MenuItem

1 *
+Add(inout Document)

Invoker

1 *
+Add(in MenuItem)

Command
1

+Clicked()

+Execute()

*
*
Document

OpenCommand PasteCommand

ConcreteCommand

MacroCommand

+Execute()
+AskUser()

+Execute()

+Execute()

+Execute()

+Open()
+Close()
+Cut()
+Copy()
+Paste()

Receiver

for all c in command


c->Execute();
Command -> Execute ()
document->Paste();

name = AskUser();
doc = new Document(name);
application->Add(doc);
doc->Open();

receiver->Action();

GAMMA et al.: Design Patterns, Elements of Reusable Object-Oriented Software,


Addison Wessley Longmann, 1998

Memento

Object Interaction

Data Transfer Object

Object Interaction

Message

Object Interaction

Bridge 1/2

Several different implementation (platform specific, runtime decision,).


Interface abstraction refinement.
Separate implementor hierarchy, providing various implementation.
Adaptation and Extension

Bridge 2/2

GAMMA et al.: Design Patterns, Elements of Reusable Object-Oriented Software,


Addison Wessley Longmann, 1998

Object Adapter 1/2

Adaptation and Extension

Object Adapter 2/2

GAMMA et al.: Design Patterns, Elements of Reusable Object-Oriented Software,


Addison Wessley Longmann, 1998

Chain of Responsibility

Adaptation and Extension

Interpreter 1/3

Adaptation and Extension

Interpreter 1/3

GAMMA et al.: Design Patterns, Elements of Reusable Object-Oriented Software,


Addison Wessley Longmann, 1998

Interpreter 1/3

GAMMA et al.: Design Patterns, Elements of Reusable Object-Oriented Software,


Addison Wessley Longmann, 1998

Interceptor

Registering out of-band service extensions


via predefined callback interfaces.
Trigger when specific events occur.

Adaptation and Extension

Visitor 1/4

Adaptation and Extension

Visitor 2/4

Visitor 3/4

Visitor 4/4

Decorator 1/3

Adaptation and Extension

Decorator 2/3

window->SetContents(
new BorderDecorator(
new ScrollDecorator(textView), 1
)

Decorator 3/3

Execute-Around Object

Constructor and destructor to perform pre- and post-sequence actions.

Adaptation and Extension

Template Method

Adaptation and Extension

Strategy

Adaptation and Extension

Null Object

Napojenie DB.
Priehradky platov zamestnancov.

Adaptation and Extension

Wrapper Facade

Avoid accessing low-level function-based APIs directly.


Faade interface partitioning,

Adaptation and Extension

You might also like