Lecture - 4
Lecture - 4
Object-oriented Analysis –
Dynamic Model
Introduction
Requirements
Elicitation
Analysis
“Analysis Cloud”
2BwatchInput 2BwatchDisplay
2BwatchTime
Example of a Communication
Diagram
Joe sets the time on 2Bwatch
Joe:2BwatchOwner
1:pressButtons1And2()
2:pressButton1()
3:pressButton2() 1.1:blinkHours()
4:pressButtons1And2() 2.1:blinkMinutes()
4.2:stopBlinking()
:2BwatchInput :2BwatchDisplay
3.1:incrementMinutes()
4.1:commitNewTime()
3.2:refresh()
:2BwatchTime
Heuristics for Sequence Diagrams
• Layout:
1st column: Should be the actor of the use case
2nd column: Should be a boundary object
3rd column: Should be the control object that
manages the rest of the use case
• Creation of objects:
• Create control objects at beginning of event flow.
• The control objects create the boundary objects.
• Access of objects:
• Entity objects can be accessed by control and
boundary objects.
• Entity objects should not access boundary or
control objects.
Example: Finding Objects from a
Sequence Diagram
• Let’s assume ARENA’s object model: contains
the following five objects
• League Owner, League, Tournament, Match and Player
Tournament
Attributes
Operations
Player * * Match
Attributes Attributes
Operations Operations
Example: Finding Objects from a
Sequence Diagram
newTournament
(league)
:Announce
«new» Tournament
Control
checkMax
Tournament()
setName(name)
setMaxPlayers
(maxp)
commit() create
createTournament Tournament
(name, maxp) «new»
(name, maxp) :Tournament
Another Example: Finding Objects
from a Sequence Diagram
newTournament
(league)
:Announce
«new» Tournament
Control
checkMax
Tournament()
setName(name)
setMaxPlayers
(maxp)
commit() create
createTournament Tournament
(name, maxp) «new»
(name, maxp) :Tournament
Impact on Arena’s Object Model
League Owner League
1 *
Attributes Attributes
Operations Operations
Arena Tournament_
Boundary
Attributes Attributes
Operations Operations
Tournament
Announce_ Attributes
Tournament_ Operations
Control
Attributes
Operations
Player Match
* *
Attributes Attributes
Operations Operations
Impact on ARENA’s Object Model (2)
• Question:
• Who owns these events?
• Answer:
• For each object that receives an event there is a public
operation in its associated class.
• The name of the operation is usually the name of the
event.
Example from the Sequence
Diagram
:Tournament
Boundary :Arena :League
League
Owner
newTournament
(league)
:Announce
«new» Tournament
Control
checkMax
Tournament()
setName(name)
setMaxPlayers
(maxp)
commit() create
createTournament Tournament
(name, maxp) «new»
(name, maxp) :Tournament
League Owner League
1 *
Attributes Attributes
Operations Operations
Tournament_
Boundary
Arena Attributes
Operations
Attributes
Operations
Tournament
Announce_
Tournament_ Attributes
Control Operations
Attributes
createTournament
(name, maxp)
Player Match
* *
Attributes Attributes
Operations Operations
What else can we get out of
Sequence Diagrams?
• Sequence diagrams are derived from use cases.
Control
Object
Stair Diagram
State1 Event
Event(attr) [condition]/action State2
do/Activity
entry /action Guard
condition
exit/action
M M
fM
I I
R R
fR
Examples for Inconsistency and
Completeness Problems
• Different spellings in different UML diagrams
• Omissions in diagrams
Different spellings in different UML
diagrams
UML Sequence Diagram UML Class Diagram
LeagueOwner League
1 *
createTournament Attributes Attributes
(name, maxp)
Operations Operations
Tournament_
Boundary
Attributes
Operations
Tournament
Announce_
Tournament_ Attributes
Control
Operations
Attributes
makeTournament
Different spellings (name, maxp)
in different models
for the same operation Player Match
* *
Attributes Attributes
Operations Operations
Omissions in some UML Diagrams
Class Diagram
Tournament_ Missing
Boundary
Attributes Association
Operations (Incomplete
Tournament
Analysis?)
Missing class
Attributes
(The control object
Operations
Announce_Tournament
is mentioned in the
sequence diagram)
Player * Match
*
Attributes Attributes
Operations Operations
Checklist for a Requirements Review
(2)
• Syntactical check of the models
• Check for consistent naming of classes,
attributes, methods in different subsystems
• Identify dangling associations (“pointing to
nowhere”)
• Identify double- defined classes
• Identify missing classes (mentioned in one
model but not defined anywhere)
• Check for classes with the same name but
different meanings
When is a Model Dominant?
• Object model:
• The system has classes with nontrivial states and many
relationships between the classes
• Dynamic model:
• The model has many different types of events: Input,
output, exceptions, errors, etc.
• Functional model:
• The model performs complicated transformations (eg.
computations consisting of many steps)
• Which model is dominant in these applications?
• Compiler
• Database system
• Spreadsheet program
Examples of Dominant Models
• Compiler:
• The functional model is most important
• The dynamic model is trivial because there is only one
type input and only a few outputs
• Is that true for developmentenvironments (e.g.
Eclipse)?
• Database systems:
• The object model most important
• The functional model is trivial, because the purpose of
the functions is to store, organize and retrieve data
• Spreadsheet program:
• The functional model most important
• The dynamic model is interesting if the program allows
computations on a cell
• The object model is trivial.
Let’s Do Analysis: A Toy Example
Power(on) Power(on)
Power(off) Power(off)
Power(on) Power(on)
Toy Car: Dynamic Model
Wheel
Headlight
Forward
Off power
power off
on
power power
off on
Stationary Stationary
On
power power
on
off
Backward
Toy Car: Object Model
Car