1spring 2005 specification and analysis of information systems modeling behavior with uml sequence...
Post on 20-Dec-2015
217 views
TRANSCRIPT
![Page 1: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/1.jpg)
1Spring 2005Specification and Analysis of Information Systems
Modeling Behavior with UML Sequence Diagrams
Eran Toch
http://www.technion.ac.il/~erant
Spring 2007
![Page 2: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/2.jpg)
2
Outline
• Introduction
• Basic notation
• Alternating paths
• Modularity
![Page 3: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/3.jpg)
3
Modeling Process
Introduction | Basics | Alternations | Modularity
PhaseActionsOutcome
InitiationRaising a business needBusiness documents
RequirementsInterviewing stakeholders, exploring the system environment
Organized documentation
SpecificationAnalyze the engineering aspect of the system, building system concepts
Formal specification
DesignDefine architecture, components, data types, algorithms
Formal Specification
ImplementationProgram, build, unit-testing, integrate, documentation
Testable system
Testing & Integration
Integrate all components, verification, validation, installation, guidance
Testing results, Working sys
MaintenanceBug fixes, modifications, adaptationSystem versions
![Page 4: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/4.jpg)
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
![Page 5: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/5.jpg)
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
![Page 6: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/6.jpg)
6
Behavior Modeling
In process
supplied
OrderCheckoutManager
Order
message: changestatus
Add to cart
Check availability
Supply Order
Notify User
[okay][problem]
Sequence Diagrams Activity Diagrams State Diagrams
Introduction | Basics | Alternations | Modularity
* We will not talk about collaboration diagrams
Inventory
message: create
![Page 7: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/7.jpg)
7
Outline
• Introduction
• Basic elements
• Alternating paths
• Modularity
![Page 8: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/8.jpg)
8
Building a Sequence Diagrams
Class AClass C
Class BClass D
Use Case 1
Use Case 2Use Case 3
Sequence diagrams capture the use-case behavior using the foundation of the classes.
therefore Sequence = Objects + messages
Introduction | Basics | Alternations | Modularity
![Page 9: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/9.jpg)
9
Sequence Diagrams
p : Product : ShooppingCart
addProduct (p)
customer
display)(
getPrice)(
checkout ()
sd Product Buyingobjects
message
Life line
activation )focus of control(
Diagram Name
• A simple sequence diagram:
Introduction | Basics | Alternations | Modularity
![Page 10: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/10.jpg)
10
Object Control
obj1 : Class1 obj2 : Class2
do (…)
: Class3create (…)
obj1 : Class1
useroperate)( Object
Creation
Object Destruction
Return Message
foo()Messages to
self
Introduction | Basics | Alternations | Modularity
Illustration
![Page 11: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/11.jpg)
11
Illustration
Corresponding Class Diagram
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
![Page 12: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/12.jpg)
12
Sequences and Use-Cases
p : Product : ShooppingCart
addProduct (p)
: Ordercreate (…)
customer
display)(
getPrice)(
checkout ()
Introduction | Basics | Alternations | Modularity
Hidden partVisible part
![Page 13: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/13.jpg)
13
![Page 14: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/14.jpg)
14
Full Message Attributes
C3.1: res := getLocation )fig(
sequence number
return value
message name argument list
[sequence-expression][return-value :=] [message-name] [(argument-list)]
Introduction | Basics | Alternations | Modularity
![Page 15: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/15.jpg)
15
Different Kinds of Messages
Synchronous Message
asynchronous Message
Return Message
Introduction | Basics | Alternations | Modularity
![Page 16: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/16.jpg)
16
Synchronous & Asynchronous Messages
teller : Order : Article
Nested Flow
getValue
price
setID
appl err handl alarm
Asynchronous Flow
unknown
ring
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
unknown
log
Introduction | Basics | Alternations | Modularity
Example Example
![Page 17: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/17.jpg)
17
Outline
• Introduction
• Basic elements
• Alternating paths
• Modularity
![Page 18: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/18.jpg)
18
Flow Constructs
When we tell a scenario, which types of alternatives do we need?
Introduction | Basics | Alternations | Modularity
IfElseLoopRepeatJump
![Page 19: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/19.jpg)
19
Example
Options
archive)msg(
msg : Message :Database
opt
Do something...
[msg.status=confirmed]
Fragment
Condition
Introduction | Basics | Alternations | Modularity
Used for modeling simple optional blocks.Has one operand; no "else" guard.
![Page 20: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/20.jpg)
20
Alternatives
archive)msg(
msg : Message :Database
Condition
:Admin
alt
notify)msg.getID)((
wait)(
[msg.status=confirmed]
[msg.status=error]
[else]
Else condition)optional(
Alternative Fragment group
Execution regions. At most one will execute.
Introduction | Basics | Alternations | Modularity
![Page 21: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/21.jpg)
21
Loops
Display)(
: OS :Folder :File
loop
loop
Display)(
[for each Folder]
[for each File]
Loop Fragment
Condition
Nested Loop Fragment
Introduction | Basics | Alternations | Modularity
![Page 22: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/22.jpg)
22
Breaks
isLooged = login)name,pass(
: User :User Manager : Policy
addBadLogin)name(
break
[¬isLooged]
Do something…
Do something …
If the condition is met, the break fragment is executed, and the reminder of the sequence is ignored
Handy in model exception handling
Introduction | Basics | Alternations | Modularity
![Page 23: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/23.jpg)
23
Examples of Guards
• [for each Object]
• [5]
• [i=1..5]
• [status = okay]
• No guard means an infinite loop
Introduction | Basics | Alternations | Modularity
![Page 24: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/24.jpg)
24
Outline
• Introduction
• Basic elements
• Alternating paths
• Modularity
![Page 25: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/25.jpg)
25
Modularity
We need ways to create modular scenarios
Introduction | Basics | Alternations | Modularity
![Page 26: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/26.jpg)
26
Referencing a diagram
login)name,pass(
: User :User Manager : Policy
Login Handling)user,pass( :bool
ref
Do something…
Do something …
Reference Gate
Introduction | Basics | Alternations | Modularity
![Page 27: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/27.jpg)
27
Referenced Diagram
: User Manager :UserAccount
sd Login Handling
loop
cName -= getUseNamer)(
[for each UserAccount]
login)name,pass(
opt
[cName = name]
cName -= getUseNamer)(
isInSystem)true(
true
false
Diagram name
Input message
Output message
Introduction | Basics | Alternations | Modularity
![Page 28: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/28.jpg)
28
Parallel Fragments
provideDetails)…(
: User :Checkout
Handler : Shipping
Handler
performCheckout)(
: Transaction Handler
parShip)address,products(
provideDetails)…(
chargeMoney)CC,sum(
Introduction | Basics | Alternations | Modularity
![Page 29: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/29.jpg)
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
![Page 30: 1Spring 2005 Specification and Analysis of Information Systems Modeling Behavior with UML Sequence Diagrams Eran Toch erant](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d4e5503460f94a2d220/html5/thumbnails/30.jpg)
30
Summary
Behavior ModelingSequence models interaction
LanguageObjects + lifeline
Messages
AlternationsLoops
Alternatives
ModularityReferencing
Parallel
Introduction | Basics | Alternations | Modularity