CSE 403 Lecture 8 UML Sequence Diagrams Reading: UML Distilled, Ch. 4, M. Fowler slides created by Marty Stepp

Slides:



Advertisements
Similar presentations

Advertisements

Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
System Sequence Diagrams
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
Summary Class responsibility cards can be used to help allocate responsibilities between different classes. The use of stereotype classes, such as entity,
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Object Collaborations. Objectives: Object Interaction (cont.) You will be able to:  Use sequence diagrams to detail object interactions.
SE-565 Software System Requirements More UML Diagrams.
VOCABULARY  Deck or pack  Suit  Hearts  Clubs  Diamonds  Spades  Dealer  Shuffle  Pick up  Rank  Draw  Set  Joker  Jack 
1 CSE 403 Design and UML Class Diagrams Reading: UML Distilled Ch. 3, by M. Fowler These lecture slides are copyright (C) Marty Stepp, They may not.
1 TCSS 360, Spring 2005 Lecture Notes Design Phase and UML Class Diagrams Relevant Reading: UML Distilled, Third Edition M. Fowler.
SEQUENCE DIAGRAM Prepared by: T. Fatimah Alageel.
UML Sequence Diagrams Reading: UML Distilled Ch. 4, by M. Fowler
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Sequence Diagram Tutorial
1 iSee Player Tutorial Using the Forest Biomass Accumulation Model as an Example ( Tutorial Developed by: (
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
By: Muhammad Aamir Salem
InDesign CS3 Lesson 4 ( Only pages ) Importing and Editing Text.
Sequence Diagrams.
Introduction to Interaction Diagrams Used to illustrate the dynamic behaviour of a community of objects that collaborate by passing messages in order to.
UML S EQUENCE D IAGRAMS 1 Dr. Hoang Huu Hanh, OST – Hue University hanh-at-hueuni.edu.vn.
System Sequence Diagrams. Recap When to create SSD? How to identify classes/instances? Use case descriptions UML notations for SSD.
1 Sequence Diagrams (Based on Stevens and Pooley (2006, Chapters 9, 10) and Fowler (2004, Chapter 4)) David Meredith Aalborg University.
Computer Science 340 Software Design & Testing UML Sequence Diagrams.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
UML January 26, 2011 CSE 403, Winter 2011, Brun UML Sequence Diagrams.
CSC172 Class Design Pepper. Goals How to design classes How to think in terms of objects StarUML Code Generation.
Collaboration Diagrams CSIS3600. What is a Collaboration Diagram Collaboration diagrams illustrate interactions between objects The collaboration diagram.
1 UML Sequence Diagrams UML Distilled, Third Edition, Chapter 4 M. Fowler.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
 C-style pointer-based arrays  Have great potential for errors and several shortcomings  C++ does not check whether subscripts fall outside the range.
Coming up: Interaction Diagrams Sequence Diagrams Dan Fleck.
Interaction Diagrams Interaction Diagrams allow the designer to show how groups of objects collaborate in some behavior. –Interaction Diagrams will show.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour UML Sequence Diagram.
Sequence Diagrams And Collaboration Diagrams HungNM.
Design Jon Walker. More UML ● What is UML again?
Use Case Driven Analysis Requirements Use Case Use Case Description System Sequence Diagram Chapter 5.
CSC480 Class Design Pepper. Goals How to design classes StarUML Code Generation.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Coming up: Interaction Diagrams Sequence Diagrams Dan Fleck.
Coming up: Interaction Diagrams Sequence Diagrams Dan Fleck.
Chapter 3: Introducing the UML
Use Case Diagrams. Introduction In the previous Lecture, you saw a brief review of the nine UML diagrams. Now that you have the clear, you'll start to.
Star UML and CRC Cards Pepper.
Sequence diagrams Lecture 5. Main terms  Interaction  Life line  Activation  Executable behavior and derived behavior  Messages  Trajectory  Frame.
Sequence Diagram Lecture # 1. Sequence Diagram Definition A Sequence diagram is an interaction diagram that shows how the objects and classes involved.
Training Guide for Residents
CIE 203 Software Engineering Lecture 12: Sequence Diagrams
TCSS 305 (Stepp) OO Design with UML Class Diagrams
Sequence Diagram.
Standard UML: Communication and Dynamic Behavior
UML SEQUENCE DIAGRAM.
UML Modeling Sequence diagram
UML UML Sequence Diagrams CSE 403
Lecture on Design Phase and UML Class Diagrams
Prepared By Sidra Noureen
Object Oriented Analysis and Design
IMAT5205 Systems Analysis and Design
Superior University, Lahore
Unified Modelling Language
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Midterm Review CSCI 360, Dr. X.
Chapter 4 Sequence Diagrams
Presentation transcript:

CSE 403 Lecture 8 UML Sequence Diagrams Reading: UML Distilled, Ch. 4, M. Fowler slides created by Marty Stepp

2 UML sequence diagrams sequence diagram: an "interaction diagram" that models a single scenario executing in the system –perhaps 2nd most used UML diagram (behind class diagram) relation of UML diagrams to other exercises: –CRC cards  class diagram –use cases  sequence diagrams

3 Parts of a seq.diagram

4 Sequence diag. key parts participant: object or entity that acts in the diagram –diagram starts with an unattached "found message" arrow message: communication between participant objects the axes in a sequence diagram: –horizontal:which object/participant is acting –vertical:time (down = forward in time)

5 Seq. diag. examples

6 Representing objects Squares with object type, optionally preceded by "name :" –write object's name if it clarifies the diagram –object's "life line" represented by dashed vert. line

7 messages (method calls) indicated by arrow to other object –write message name and arguments above arrow Messages between objects

8 Messages, continued messages (method calls) indicated by arrow to other object –dashed arrow back indicates return –different arrowheads for normal / concurrent (asynchronous) calls

9 Lifetime of objects creation: arrow with 'new' written above it –notice that an object created after the start of the scenario appears lower than the others deletion: an X at bottom of object's lifeline –Java doesn't explicitly delete objects; they fall out of scope and are garbage-collected

10 Indicating method calls 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 Activation Nesting

11 Selection and loops 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 Linking sequence diagrams If one diagram is too large or refers to another, indicate with: –an unfinished arrow and comment, –or a "ref" frame that names the other diagram when would this occur in our system?

13 Example sequence diagram

14 Forms of system control What can you say about the control flow of each system? –Is it centralized? –Is it distributed?

15 Flawed sequence diagram 1 What's wrong with this sequence diagram? (Look at the UML syntax and the viability of the scenario.)

16 Flawed sequence diagram 2 What's wrong with this sequence diagram?

17 Why not just code it? Sequence diagrams can be somewhat close to the code level. So why not just code up that algorithm rather than drawing it as a sequence diagram? –a good sequence diagram is still a bit above the level of the real code (not all code is drawn on diagram) –sequence diagrams are language-agnostic (can be implemented in many different languages –non-coders can do sequence diagrams –easier to do sequence diagrams as a team –can see many objects/classes at a time on same page (visual bandwidth)

18 Sequence diagram exercise Let's do a sequence diagram for the following poker casual use case, Start New Game Round : The scenario begins when the player chooses to start a new round in the UI. The UI asks whether any new players want to join the round; if so, the new players are added using the UI. All players' hands are emptied into the deck, which is then shuffled. The player left of the dealer supplies an ante bet of the proper amount. Next each player is dealt a hand of two cards from the deck in a round- robin fashion; one card to each player, then the second card. If the player left of the dealer doesn't have enough money to ante, he/she is removed from the game, and the next player supplies the ante. If that player also cannot afford the ante, this cycle continues until such a player is found or all players are removed.

19 Poker sequence diagram

20 Sequence diagram question Consider the possible poker use case, Betting Round : The scenario begins after the Start New Round case has completed. The UI asks the first player for a bet. That player chooses to either bet a given amount, or check (no bet). The next player is asked what to do. If the prior player placed a bet, the next player must either match ("see") it, or match it plus add an additional bet ("raise"), or choose not to match and exit the round ("fold"). This continues around the table until an entire pass is made in which all players have either matched all other players' bets or folded. If the next player doesn't have enough money to match the current bet, the player is allowed to bet all of their money. But they can then win only up to the amount they bet; the rest is a "side pot" among the more wealthy players remaining in the round. Why is it hard to diagram this case as a sequence diagram?

21 Poker sequence diagram 2

22 Sequence diagram exercise Let's do a sequence diagram for the following casual use case for a scheduler app, Add Calendar Appointment : The scenario begins when the user chooses to add a new appointment in the UI. The UI notices which part of the calendar is active and pops up an Add Appointment window for that date and time. The user enters information about the appointment's name, location, start and end times. The UI will prevent the user from entering an appointment that has invalid information, such as an empty name or negative duration. The calendar records the new appointment in the user's list of appointments. Any reminder selected by the user is added to the list of reminders. If the user already has an appointment at that time, the user is shown a message and asked to choose an available time or replace the appointment. If the user enters an appointment with the same name and duration as an existing meeting, the calendar asks the user whether he/she intended to join that meeting instead. If so, the user is added to that meeting's list of participants.