Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Class: Adv Topic/Software Engineering; Subject: Computer Science & Engineering; University: University of California - San Diego; Term: Winter 2003;
Typology: Study notes
1 / 39
California Institute for Telecommunications
and Information TechnologiesLa Jolla, CA 92093-0405, USA
Department of Computer Science & Engineering
University of California, San Diego
La Jolla, CA 92093-0114, USA
Ingolf H. Krueger
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Recap: Patterns for Architecture and Design
-^
Adapter
-^
Decorator
-^
Proxy
-^
Observer
-^
Model-View-Controller
-^
Recursive Control
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
adapted from [POSA96]
Pattern
Architectural Pattern
Design Pattern
Idiom
-^
Describes
one proven solution for a recurrent
design problem
-^
Defines the context for the solution’sapplicability
granularity
coarse
fine
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Key steps during the design of components and theirinterfaces:
Application of design patterns
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Recap: Patterns for Architecture and Design
-^
Adapter
-^
Decorator
-^
Proxy
-^
Observer
-^
Model-View-Controller
-^
Recursive Control
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Context & Problem
target) offers the desired functionality
Solution:
interface
the target
target; adjust the relayed calls towards the interface of thetarget
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Structure:
«interface»^ Adapter DesiredInterface
Service() Service()
TargetComponent
TargetService()target
Environment
1
Service() {return target.TargetService();}
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Behavior:
:TargetComponent
:Adapter
:Environment
Service()
TargetService()
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Consequences:
design’s transparency
clients of target required to accommodate the adapter's interface
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Recap: Patterns for Architecture and Design
-^
Adapter
-^
Decorator
-^
Proxy
-^
Observer
-^
Model-View-Controller
-^
Recursive Control
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Context & Problem
behavior is required
interface has to remain unchanged
Solution:
match the required modifications, and relay the adjusted resultto the original caller
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Structure:
«interface» ComponentInterface^ Service()
Environment
Decorator^ Service()
Component
Service()
Decorator A
Service()
Decorator Z
Service()
component ...
Service(){
component.Service();...additional behavior... }
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Behavior:
:Decorator B
:Decorator A
:Environment
Service()
Service()
:Component
Service()
additionalBehavior()
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Consequences:
(potential performance loss)
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Recap: Patterns for Architecture and Design
-^
Adapter
-^
Decorator
-^
Proxy
-^
Observer
-^
Model-View-Controller
-^
Recursive Control
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Context & Problem
required
efficiency, or distribution requirements
Solution:
the target component
and distribution requirements
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Structure:
«interface»^ ServiceInterface^ Service()
Environment
ServiceProvider
Service()
ServiceProxy
Service()
target
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Behavior:
:ServiceProvider
:ServiceProxy
:Environment
Service()
Service() pre() post()
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Consequences:
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Recap: Patterns for Architecture and Design
-^
Adapter
-^
Decorator
-^
Proxy
-^
Observer
-^
Model-View-Controller
-^
Recursive Control
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Context & Problem
changes of the target
target required
Solution:
source
changes detach/unregister from the target
notification message to all registered components
after they have been notified
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Structure:
Source AbstractSource^ Attach(Observer)Detach(Observer)
Notify()^ stateGetState()SetState()
Observer AbstractObserver
Update() Update()
observers
1 subject
for all o in observers {o.Update();}
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Behavior:
o2:Observer
o1:Observer
:Source
SetState()^ Update() GetState()
Update() GetState()
Notify()
© Ingolf H. Krueger
February 4, 2003
CSE/CAL·(IT)
2
Consequences:
Solution: apply multiple update strategies (strategy pattern)