Professional Documents
Culture Documents
L7 Dynamic Modeling Chapter5
L7 Dynamic Modeling Chapter5
Dynamic Modeling
Chapter 5, Analysis:
Outline of the Lecture
• Dynamic modeling
• Interaction Diagrams
• Sequence diagrams
• Communication diagrams
• State diagrams
• Activity diagrams
• Requirements analysis model validation
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2
UML Diagrams
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3
Dynamic Modeling
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4
How do we detect operations?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5
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:
• Control objects are created by boundary objects initiating use
cases
• 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.
• This makes it easier to share entity objects across use cases and
makes entity objects resilient against technology-induced changes
in boundary objects.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6
An Example: Finding Objects from a
Sequence Diagram
• Let’s assume ARENA’s object model contains - at
this modeling stage – the following six objects
• League Owner, League, Tournament, Match and Player
Tournament
Attributes
Operations
Player * * Match
Attributes Attributes
Operations Operations
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7
An Example: Finding Objects from a
Sequence Diagram
• Let’s assume ARENA’s object model contains - at
this modeling stage – the following six objects
• League Owner, League, Tournament, Match and Player
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8
ARENA Sequence Diagram: Create Tournament
: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
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9
An Example: Finding Objects from a
Sequence Diagram
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10
ARENA Sequence Diagram: Create Tournament
: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
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 11
Impact on Arena’s Object Model
League Owner League
1 *
Attributes Attributes
Operations Operations
Arena TournamentBoundary
Attributes Attributes
Operations Operations
Tournament
Announce Attributes
Tournament Operations
Control
Attributes
Operations
Player Match
* *
Attributes Attributes
Operations Operations
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12
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.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13
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
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14
League Owner League
1 *
Attributes Attributes
Operations Operations
Tournament_
Boundary
Arena Attributes
Operations
Attributes
Tournament
Operations Announce_
Tournament_ Attributes
Control Operations
Attributes
createTournament
(name, maxp)
Player Match
* *
Attributes Attributes
Operations Operations
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15
UML Interaction Diagrams
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16
Example of a Communication Diagram
1) We start with the Class Diagram for 2Bwatch
2) Then we look at the sequence of events when
Joe sets the time on 2Bwatch
Watch LCDDisplay
Time
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17
Example of a Communication Diagram
Joe sets the time on 2Bwatch
:WatchUser
1:pressButtons1And2()
2:pressButton1()
3:pressButton2() 1.1:blinkHours()
4:pressButtons1And2() 2.1:blinkMinutes()
4.2:stopBlinking()
:Watch :LCDDisplay
3.1:incrementMinutes()
4.1:commitNewTime()
3.2:refresh()
:Time
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18
Same Example with a Sequence Diagram
time
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19
Review: UML Statechart Diagram Notation
Name of
Action
Event with parameters attr State
State1 Event
Event(attr) [condition]/action State2
do/Activity
entry /action Guard
condition
exit/action
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20
Example of a StateChart Diagram
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21
State Chart Diagram vs Sequence Diagram
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 22
Checklist for a Requirements Review
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 23
Checklist for a Requirements Review (2)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 24
Examples for Inconsistency and
Completeness Problems
• Different spellings in different UML diagrams
• Omissions in diagrams
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 25
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
Different spellings
makeTournament
(name, maxp)
in different models
for the same operation Player Match
* *
Attributes Attributes
Operations Operations
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 26
Omissions in some UML Diagrams
Class Diagram
Tournament_ Missing
Boundary
Attributes Association
Operations (Incomplete
Tournament
Analysis?)
Missing class
Attributes
(The control object
Operations
AnnounceTournament
is mentioned in the
sequence diagram)
Player Match
* *
Attributes Attributes
Operations Operations
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 27
Requirements Analysis Document Template
1. Introduction
2. Current system
3. Proposed system
3.1 Overview
3.2 Functional requirements
3.3 Nonfunctional requirements
3.4 Constraints (“Pseudo requirements”)
3.5 System models
3.5.1 Scenarios
3.5.2 Use case model
3.5.3 Object model
3.5.3.1 Data dictionary
3.5.3.2 Class diagrams
3.5.4 Dynamic models
3.5.5 User interfae
4. Glossary
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 28
Section 3.5 System Models
3.5.1 Scenarios
- As-is scenarios, visionary scenarios
3.5.2 Use case model
- Actors and use cases
3.5.3 Object model
- Data dictionary
- Class diagrams (classes, associations, attributes and
operations)
3.5.4 Dynamic model
- State diagrams for classes with significant dynamic
behavior
- Sequence diagrams for collaborating objects (protocol)
3.5.5 User Interface
- Navigational Paths, Screen mockups
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29
Requirements Analysis Questions
1. What are the functionalities of the system? Functional Modeling
Create scenarios and use case diagrams
- Talk to client, observe, get historical records
2. What is the structure of the system? Object Modeling
Create class diagrams
- Identify objects.
- What are the associations between them?
- What is their multiplicity?
- What are the attributes of the objects?
- What operations are defined on the objects?
3. What is its behavior?
Dynamic Modeling
Create sequence diagrams
- Identify senders and receivers
- Show sequence of events exchanged between objects.
- Identify event dependencies and event concurrency.
Create state diagrams
- Only for the dynamically interesting objects.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 30
Let’s Do Analysis: Summary
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31
Software Lifecycle Activities
covered
Object
Requirements System Implemen-
Analysis (Detailed) Testing
Elicitation Design tation
Design
Implemented
Expressed in By
Structured By Realized By
Terms Of Verified
By
class...
class...
class... ?
class.... ?
Use Case Application Solution
Domain Subsystems Source Test
Model Domain
Objects Code Case Model
Objects
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 32
Assignments
• Read Chapter 5
• Especially Section 5.6 ARENA Case Study
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 33
Case Studies
• FRIEND – Analysis
• ARENA – Analysis
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 34