Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book

Similar presentations


Presentation on theme: "Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book"— Presentation transcript:

1 Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book

2 Sequence diagrams: An Interaction Model
Used to model the interactions between the actors and the objects within a system. The objects and actors involved are listed along the top of the diagram, with a dotted line drawn vertically from these. Interactions between objects are indicated by annotated arrows. Detail how operations are carried out Dynamic Diagrams Organized according to time The time progresses as you go down the page The objects involved in the operation are listed from left to right according to when they take part in the message sequence. Create a sequence diagram for each use case scenario

3 Sequence Diagram (make a phone call)
actors and objects Object lifeline

4 Sequence Diagrams Sequence diagrams show how instance exchange messages. An instance can be: An object, not a class An actor Types of objects in a diagram interface object entity object control object Messages ( ) can be Simple like: One object sends a message to a passive object The sender does not care what happens to the message Messages can be Return messages ( ) Results of procedure calls

5 Sequence Diagrams Activation: thick box over object's life line; drawn when object's method is on the stack either that object is running its code, or it is on the stack waiting for another object's method to finish nest activations to indicate recursion

6 Sequence Diagrams Messages have a specific format *[iteration]
[Condition] Sequence Number. Return value := MessageName(Arguments) *[iteration] [Condition] Sequence Number. Return value := MessageName(Arguments)

7 Sequence Diagrams Messages can be Constructors, the message creates the recipient

8 Sequence Diagrams Messages can be Destructors, the message destroys the recipient.

9 whose Sender will not be specified
Sequence Diagrams A Found message whose Sender will not be specified

10 Message to “self” or “this”
Sequence Diagrams Found Message Message to “self” or “this”

11 Sequence Diagrams frame: box around part of diagram to indicate if or loop if -> (opt) [condition] if/else -> (alt) [condition], separated by horizontal dashed line loop -> (loop) [condition or items to loop over]

12 loop If/else If

13 Creating methods from sequence diagrams
:Register :ProductCatalogue Sale :ProductSpec addLineItem(itemID, quantity) 1. Spec=getSpecification(itemID) 1.1 Spec=Find(itemID) 2. makeLineItem(spec,quantity) 2.1 sli= Create(spec,quantity) :SalesLineItem 2.2 Add(sli)

14 Creating methods from sequence diagrams
Lost Message

15 Sequence diagram for View patient information

16 Sequence diagram to code

17 Effective Sequence Diagrams
Use only instances and actors Concentrate on actions, not on instance static details Imaging as much real-time scenarios as you can, and model them Keep in mind that a programmer will read your design, so make it as clear as possible. Sequence diagrams contain the same information as Collaboration diagrams, but emphasize the sequence of the messages instead of the relationships between the objects.


Download ppt "Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book"

Similar presentations


Ads by Google