Title: Facade Design Pattern Structure
1Facade Design Pattern Structure
Façade exposed
1
Client
This call replaced by 1 2 (Client cant refer
to P)
2
not exposed
not exposed
P not exposed
not exposed
not exposed
not exposed
Adapted from Software Engineering An
Object-Oriented Perspective by Eric J. Braude
(Wiley 2001), with permission.
2Architecture and Modularization of Encounter
Role-playing Game
EncounterGame
EncounterGame facade
EncounterCharacters
EncounterCast facade
EncounterEnvironment
EncounterEnvironment facade
Adapted from Software Engineering An
Object-Oriented Perspective by Eric J. Braude
(Wiley 2001), with permission.
3Observer Design Pattern
Server part
Client part
Client of this system
1
Observer update()
1..n
Source notify()
2
for all Observers o o.update()
ConcreteObserver observerState update()
ConcreteSubject state
subject
3
if() observerState subject.getState()
Gamma et al
4Observer Applied to International Hamburger Co.
User of this system
Server part
Client part
Observer update()
1..n
Source notify()
1
for all Observers o o.update()
2
SeniorManagement observerState update()
Headquarters demand
Marketing marketingDemand update() doDisplay()
hq
3
if( abs( hq.demand - marketingDemand ) gt 0.01 )
marketingDemand hq.getDemand() doDisplay()
Adapted from Software Engineering An
Object-Oriented Perspective by Eric J. Braude
(Wiley 2001), with permission.
50bserver class diagram
6Observer interaction diagram
7State Design Pattern Structure doRequest()
behaves according to state of Target
state.handleRequest()
Client
Target doRequest()
TargetState handleRequest()
targetState
1
target Target
TargetStateB handleRequest()
TargetStateA handleRequest()
. . . . . .
Gamma et al
8State Design Pattern Applied to Role-Playing Game
RolePlayingGame
state
RPGame handleEvent()
GameState handleEvent()
state.handleEvent()
EncounterGame
EncounterGame
Waiting handleEvent()
Setting Qualities handleEvent()
Reporting handleEvent()
Engaging handleEvent()
SettingUp handleEvent()
Adapted from Software Engineering An
Object-Oriented Perspective by Eric J. Braude
(Wiley 2001), with permission.
9Interpreter Design Pattern
OrderApplication
Component assemble()
system1
System assemble()
10Interpreter Design Pattern
1..n
AbstractExpression interpret()
Client
TerminalExpression interpret()
NonTerminalExpression interpret()
Gamma et al
11Application of Interpreter Design Pattern
n1 getNewName() n2 getnewName() System.out.p
rintln ( \nConstruct n1 as follows
system1.assemble() \nConstruct n2 as
follows system2.assemble() \nConnect
n1 and n2)
OrderApplication
Component assemble()
system1
System assemble()
return( \tComputer with cpu.assemble()
and ram.assemble())
system2
return( getDescription )
CPU assemble()
cpu
Computer assemble()
RAM assemble() getRAMType()
ram
Adapted from Software Engineering An
Object-Oriented Perspective by Eric J. Braude
(Wiley 2001), with permission.
12Model-View-ControllerArchitectural Pattern
- Model-view-controller pattern (simplified)
- Problem
- The user interface may change frequently. The
databases may be used by several applications. We
dont want to revise the entire application
whenever the interface changes or modify the
database whenever business rules change. What to
do? - Solution
- Divide applications into three areas of concern
- Model stores data
- View receives, retrieves and displays data
- Controller manages events, coordinates with
model and view
13 14Sequence Diagram for MVC
15Delegering - klassediagram
16Delegering sekvensdiagram
17(No Transcript)
18(No Transcript)
19(No Transcript)
20(No Transcript)
21Heterogeneous redundancy
- Is structurally the same as homogeneous
redundancy but the two systems primary and
secondary - are different.
22(No Transcript)
23(No Transcript)