Modeling behavior with Sequence diagrams
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Modeling behavior with Sequence diagrams

on

  • 10,006 views

Modeling software interaction and behavior with sequence diagrams

Modeling software interaction and behavior with sequence diagrams

Statistics

Views

Total Views
10,006
Views on SlideShare
9,969
Embed Views
37

Actions

Likes
7
Downloads
310
Comments
0

2 Embeds 37

http://www.slideshare.net 36
http://www.slideee.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Modeling behavior with Sequence diagrams Presentation Transcript

  • 1. Session 5:Modeling Behavior with UML Sequence Diagrams
    Analysis and Specification of Information Systems
    Spring 2008
    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
    [if getStutus == err]
    Send message
    Resend
    Resend
    Get Status
    Adds a new msg
    Message queue
    Introduction | Basics | Alternations | Modularity
  • 6. Outline
    Introduction
    Basic elements
    Alternating paths
    Modularity
  • 7. 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
    Objects
    Sequence =
    +
    messages
    Introduction | Basics | Alternations | Modularity
  • 8. 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 ()
    Lifeline
    Introduction | Basics | Alternations | Modularity
  • 9. Object Control
    obj1 : Class1
    Illustration
    obj2 : Class2
    obj1 : Class1
    user
    Object Creation
    operate()
    do (…)
    create (…)
    : Class3
    Return Message
    foo()
    Messages to self
    Object Destruction
    Introduction | Basics | Alternations | Modularity
  • 10. 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
  • 11. Sequences and Use-Cases
    p : Product
    : ShooppingCart
    customer
    display()
    getPrice()
    addProduct (p)
    checkout ()
    create (…)
    : Order
    Hidden part
    Visible part
    Introduction | Basics | Alternations | Modularity
  • 12.
  • 13. Full Message Attributes
    sequence number
    [sequence-expression]
    [return-value :=] [message-name] [(argument-list)]
    C3.1: res := getLocation (fig)
    message name
    argument list
    return value
    Introduction | Basics | Alternations | Modularity
  • 14. Different Kinds of Messages
    Synchronous Message
    asynchronousMessage
    Return Message
    Introduction | Basics | Alternations | Modularity
  • 15. Synchronous & Asynchronous Messages
    Example
    Example
    Nested Flow
    Asynchronous Flow
    manager
    sensor
    eye
    sensor
    manager
    alarm
    check
    unknown
    unknown
    ring
    check
    operate
    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
  • 16. Outline
    Introduction
    Basic elements
    Alternating paths
    Modularity
  • 17. Flow Constructs
    If
    Loop
    Else
    Repeat
    Jump
    When we tell a scenario, which types of alternatives do we need?
    Introduction | Basics | Alternations | Modularity
  • 18. Options
    Example
    msg : Message
    : Database
    Fragment
    opt
    Condition
    [msg.status=confirmed]
    archive(msg)
    Used for modeling simple optional blocks.
    Has one operand; no "else" guard.
    Do something...
    Introduction | Basics | Alternations | Modularity
  • 19. Alternatives
    msg : Message
    : Database
    : Admin
    alt
    Alternative Fragment group
    [msg.status=confirmed]
    archive(msg)
    Condition
    [msg.status=error]
    notify(msg.getID())
    [else]
    Execution regions. At most one will execute.
    wait()
    Else condition
    (optional)
    Introduction | Basics | Alternations | Modularity
  • 20. Loops
    : OS
    : Folder
    : File
    loop
    [for each Folder]
    Loop Fragment
    Display()
    loop
    [for each File]
    Condition
    Display()
    Nested Loop Fragment
    Introduction | Basics | Alternations | Modularity
  • 21. 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
  • 22. Examples of Guards
    [for each Object]
    [5]
    [i=1..5]
    [status = okay]
    No guard means an infinite loop
    Introduction | Basics | Alternations | Modularity
  • 23. Outline
    Introduction
    Basic elements
    Alternating paths
    Modularity
  • 24. MODULARITY
    We need ways to create modular scenarios
    Introduction | Basics | Alternations | Modularity
  • 25. 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
  • 26. 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
  • 27. Summary
    • Behavior Modeling
    Sequence models interaction
    • Language
    Objects + lifeline
    Messages
    • Alternations
    Loops
    Alternatives
    • Modularity
    Referencing
    Introduction | Basics | Alternations | Modularity