Sequence Diagram
Sequence Diagram
18-2
helps identify high-level messages that enter and exit the system
10-3
18-4
18-5
18-6
18-7
3.
4.
Actor - the initiating actor of the use case is shown with the use case actor symbol. System the box indicates the system as a "black box" or as a whole. Lifelines the dashed vertical lines extending downward from the actor and system symbols, which indicate the life of the sequence. Activation bars the bars set over the lifelines indicate period of time when participant is active in the interaction.
10-8
6. 7.
Input messages - In parentheses include parameters, following same naming convention and separated with commas. Output messages return messages. Frame These can show loops, alternate fragments, or optional steps.
10-9
Identify which scenario of use case you will depict. So more important to clearly communicate a single scenario. Draw a rectangle representing the system as a whole and extend a lifeline under it. Identify each actor who directly provides an input to the system or directly receives an output from the system. Extend lifelines under the actor(s). Examine use case narrative to identify system inputs and outputs. Draw each external message as a horizontal arrow from the actor's lifeline to the system or from the system to the actor. Label inputs according to UML convention. Add frames to indicate optional messages with conditions. Frames can also indicate loops and alternate fragments. Confirm that the messages are shown in the proper sequence from top to bottom.
10-10
Interface Class - provides the means by which an actor interacts with the system.
A window, dialogue box, or screen. For nonhuman actors, an application program interface (API).
Control Class - contains application logic. Persistence Class - provides functionality to read and write to a database. Structuring the system this way makes the maintenance and enhancement of those classes simpler and easier
18-11
18-12
18-13
Entity Classes Billing Address Shipping Address Email Address Active Member Member Order Member Ordered Product Product Title Audio Title Game Title Video Title Transaction
Search for verb phrases Some will reflect manual actions, others automated
Associate behaviors and responsibilities with classes Model classes that have complex behavior Examine class diagram for additional behaviors Verify classifications
18-14
18-15
Sub Object:
Super Object: Transaction Behaviors and Responsibilities Report order information Calculate subtotal cost Calculate total order cost Update order status Create Ordered Product Delete Ordered Product
18-16
Sequence Diagram
1. 2. 3. 4. 5.
6. 7. 8. 9.
18-17
18-18
18-19
Identify the scope of the sequence diagram, whether entire use-case scenario or one step. Draw actor and interface class if scope includes that. List use-case steps down the left-hand side. Draw boxes for controller class and each entity class that must collaborate in the sequence Add persistence if scope includes that. Draw messages and point each to class that will fulfill the responsibility. Add activation bars to indicate object instance lifetimes. Add return messages as needed for clarity. Add frames for loops, optional steps, alternate steps, etc.
18-20
Communication Diagram
1.
2. 3. 4.
Class Messages Self-calls Numbering scheme - messages should be numbered with a nested scheme.
18-21
What is different?
A communication diagram is similar to a sequence diagram. But while a sequence diagram focuses on the timing or sequence of messages, a communication diagram focuses on the structural organization of objects in a network format. Sequence diagrams are generally better when you want to emphasize the sequence of calls. Communication diagrams are better when you want to emphasize the links. And they are easier when brainstorming alternative solutions.
18-22