Eran Toch - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Eran Toch

Description:

Introduction | Basics | Alternations | Modularity. Behavioral Modeling ... Introduction | Basics | Alternations | Modularity. Used for modeling simple optional blocks. ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 31
Provided by: csC76
Category:
Tags: basics | eran | toch

less

Transcript and Presenter's Notes

Title: Eran Toch


1
Spring 2007
Modeling Behavior with UML Sequence Diagrams
  • Eran Toch
  • http//www.technion.ac.il/erant

2
Outline
  • Introduction
  • Basic notation
  • Alternating paths
  • Modularity

3
Modeling Process
Introduction Basics Alternations Modularity
4
Why to Model Behavior?
  • How do we use the SMS Server interface? What is
    the order of executing the operations?
  • sendMessage, getStatus, Resend?
  • getStatus, sendMessage, checkForMessages?
  • When do we use resend?

Introduction Basics Alternations Modularity
5
Behavioral Modeling
  • Where are people coming from?
  • Where are they going?
  • How do they move from one space to the other?

Introduction Basics Alternations Modularity
6
Behavior Modeling
Sequence Diagrams
Activity Diagrams
State Diagrams
CheckoutManager
Add to cart
Order
message create
In process
Check availability
Order
supplied
message change status
okay
problem
Inventory
Supply Order
Notify User
We will not talk about collaboration diagrams
Introduction Basics Alternations Modularity
7
Outline
  • Introduction
  • Basic elements
  • Alternating paths
  • Modularity

8
Building a Sequence Diagrams
  • Sequence diagrams capture the use-case behavior
    using the foundation of the classes.

Use Case 1
Class C
Class A
Use Case 3
Use Case 2
Class D
Class B
therefore
Objects
Sequence

messages
Introduction Basics Alternations Modularity
9
Sequence Diagrams
  • A simple sequence diagram

objects
sd Product Buying
Diagram Name
p Product
ShooppingCart
customer
display()
message
getPrice()
activation (focus of control)
addProduct (p)
checkout ()
Life line
Introduction Basics Alternations Modularity
10
Object Control
Illustration
obj2 Class2
obj1 Class1
user
Object Creation
operate()
do ()
create ()
Class3
Return Message
foo()
Messages to self
Object Destruction
Introduction Basics Alternations Modularity
11
Corresponding Class Diagram
Illustration
Notice that a dependency exists whenever messages
are passed between instances of the class
Dependencies can be overridden by associations,
aggregations etc.
Introduction Basics Alternations Modularity
12
Sequences and Use-Cases
p Product
ShooppingCart
customer
display()
getPrice()
addProduct (p)
checkout ()
create ()
Order
Hidden part
Visible part
Introduction Basics Alternations Modularity
13
(No Transcript)
14
Full Message Attributes
sequence-expression return-value
message-name (argument-list)
C3.1 res getLocation (fig)
message name
argument list
return value
Introduction Basics Alternations Modularity
15
Different Kinds of Messages
Synchronous Message
asynchronous Message
Return Message
Introduction Basics Alternations Modularity
16
Synchronous Asynchronous Messages
Example
Example
Nested Flow
Asynchronous Flow
teller
Order
Article
appl
err handl
alarm
getValue
unknown
unknown
ring
price
setID
log
Price need to be finished, before teller can do
another operation (getName)
Ring is executed, while the control flow is
returned to err handle and appl
Introduction Basics Alternations Modularity
17
Outline
  • Introduction
  • Basic elements
  • Alternating paths
  • Modularity

18
Flow Constructs
If
Loop
Else
Repeat
Jump
When we tell a scenario, which types of
alternatives do we need?
Introduction Basics Alternations Modularity
19
Options
Example
msg Message
Database
Fragment
opt
Condition
msg.statusconfirmed
archive(msg)
Used for modeling simple optional blocks. Has one
operand no "else" guard.
Do something...
Introduction Basics Alternations Modularity
20
Alternatives
msg Message
Database
Admin
alt
Alternative Fragment group
msg.statusconfirmed
archive(msg)
Condition
msg.statuserror
notify(msg.getID())
else
Execution regions. At most one will execute.
wait()
Else condition (optional)
Introduction Basics Alternations Modularity
21
Loops
OS
Folder
File
loop
for each Folder
Loop Fragment
Display()
loop
for each File
Condition
Display()
Nested Loop Fragment
Introduction Basics Alternations Modularity
22
Breaks
Policy
User
User Manager
isLooged login(name,pass)
If the condition is met, the break fragment is
executed, and the reminder of the sequence is
ignored
break
isLooged
addBadLogin(name)
Do something
Handy in model exception handling
Do something
Introduction Basics Alternations Modularity
23
Examples of Guards
  • for each Object
  • 5
  • i1..5
  • status okay
  • No guard means an infinite loop

Introduction Basics Alternations Modularity
24
Outline
  • Introduction
  • Basic elements
  • Alternating paths
  • Modularity

25
Modularity
We need ways to create modular scenarios
Introduction Basics Alternations Modularity
26
Referencing a diagram
Policy
User
User Manager
login(name,pass)
ref
Login Handling(user,pass) bool
Reference Gate
Do something
Do something
Introduction Basics Alternations Modularity
27
Referenced Diagram
sd Login Handling
Diagram name
User Manager
UserAccount
loop
Input message
login(name,pass)
for each UserAccount
cName - getUseNamer()
cName - getUseNamer()
Output message
opt
cName name
isInSystem(true)
true
false
Introduction Basics Alternations Modularity
28
Parallel Fragments
User
Checkout Handler
Shipping Handler
Transaction Handler
provideDetails()
provideDetails()
performCheckout()
par
Ship(address,products)
chargeMoney(CC,sum)
Introduction Basics Alternations Modularity
29
Critical Fragment
  • the region is treated atomically by the enclosing
    fragment (i.e. parallel fragment)
  • No other operations can interfere while a
    critical region is executed

Introduction Basics Alternations Modularity
30
Summary
  • Behavior Modeling
  • Sequence models interaction
  • Language
  • Objects lifeline
  • Messages
  • Alternations
  • Loops
  • Alternatives
  • Modularity
  • Referencing
  • Parallel

Introduction Basics Alternations Modularity
Write a Comment
User Comments (0)
About PowerShow.com