Sequence Diagrams EEE321.13 - PowerPoint

Document Sample
Sequence Diagrams EEE321.13 - PowerPoint Powered By Docstoc
					Sequence Diagrams
              EEE321.13




    Royal Military College of Canada
  Electrical and Computer Engineering


                  Maj JW Paul
               Jeff.Paul@rmc.ca
            +1-613-541-6000 x6656
                     Sic pilum iactum est




EE321.13 Winter 05          Maj JW Paul     Sequence Diagrams - 2
    Review - Sub Type Inclusion
     What are three things needed for a polymorphic
     function call?
    I.       Base Class Object Reference

    II.      Over ridden methods

    III. Run-time Binding Mechanism
                 (late dispatching)


                       ALL THREE MUST BE PRESENT


EE321.13 Winter 05                    Maj JW Paul   Sequence Diagrams - 3
    Review
    What is the difference between:

    Class & Object diagrams?
    • Both are static structure diagrams
    • Latter shows a “set of objects” from a snapshot
      in time
                                                              : Bank
    Object & Collaboration diagrams?
    • Both show structure
                                                      2: getCustomerBalance


    • Collaboration diagrams add behaviour
                                          1: getBalance
                                                           royalBank
                                  anATM
                                                             : Bank

EE321.13 Winter 05        Maj JW Paul                Sequence Diagrams - 4
    Four Kinds of Visibility (of attributes)
                     The supplier object is:

    • Global         in a global scope to the client

    • Field          a part of the client

    • Parametric     a parameter to some operation
                     of the client (passed in a message)

    • Local          a locally declared object in the
                     scope of the object diagram


EE321.13 Winter 05        Maj JW Paul          Sequence Diagrams - 5
                     Lab 5




EE321.13 Winter 05   Maj JW Paul   Sequence Diagrams - 6
EE321.13 Winter 05   Maj JW Paul   Sequence Diagrams - 7
                     Today’s Class

                     Sequence Diagrams




EE321.13 Winter 05        Maj JW Paul    Sequence Diagrams - 8
    Recall UML
    •   Class Diagram
    •   Object Diagram                   Structure diagrams
    •   Component Diagram                   STATIC VIEW
    •   Deployment Diagram

    •   Use Case Diagram
    •   Sequence Diagram
    •   Collaboration Diagram            Behaviour diagrams

    •   Statechart Diagram                DYNAMIC VIEW

    •   Activity Diagram



EE321.13 Winter 05         Maj JW Paul            Sequence Diagrams - 9
    Collaboration vs Sequence Diagrams
    • Collaboration
         • shows a set of objects, links among those objects,
           and messages sent and received by those objects

    • Sequence
         • shows a set of objects, and the messages sent and
           received by those objects…



   emphasizes the                             emphasizes the time
   structural organization of                 ordering of messages
   objects that send and
   receive messages

EE321.13 Winter 05              Maj JW Paul            Sequence Diagrams - 10
    Sequence Diagrams
                                                     objects

              anATM                      royalBank :               : Bank
                                            Bank
                     getBalance(String, Integer)
                                                                              focus of
                                                  getCustomerBalance          control




 time
                                                                            end of
                                    lifeline                                the line

EE321.13 Winter 05                         Maj JW Paul             Sequence Diagrams - 11
    Example Sequence Diagram




EE321.13 Winter 05   Maj JW Paul   Sequence Diagrams - 12
    Messages




EE321.13 Winter 05   Maj JW Paul   Sequence Diagrams - 13
    Collaboration vs Sequence

                               doesn’t show lifeline
                               (could add create and destroy messages)

                               focus of control indicated by
                               numbering (nesting)


     SEMANTICALLY EQUIVALENT     but visual focus is different


                                    don’t explicitly show links

                                    sequence numbering is implicit

                                    complex branching harder to show



EE321.13 Winter 05        Maj JW Paul                      Sequence Diagrams - 14
    Example




EE321.13 Winter 05   Maj JW Paul   Sequence Diagrams - 15
Back to Lab 5
                     Scenarios




EE321.13 Winter 05     Maj JW Paul   Sequence Diagrams - 19
    Scenarios
    • A sequence of specific actions (messages) for a
      interaction diagram that represent a particular
      use case for an application

    • Each scenario will usually require its own
      interaction diagram




EE321.13 Winter 05        Maj JW Paul        Sequence Diagrams - 20
    Review
     Why do we need interaction diagrams?

     What is the difference between collaboration &
     sequence diagrams?




EE321.13 Winter 05        Maj JW Paul       Sequence Diagrams - 21