Sequence Diagram Tutorial

Slides:



Advertisements
Similar presentations
© 2005 by Prentice Hall Appendix 3 Object-Oriented Analysis and Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
Advertisements

System Sequence Diagrams
ESE Einführung in Software Engineering 7. Modeling Behaviour Prof. O. Nierstrasz.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Introduction to Software Engineering 7. Modeling Behaviour.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
Information System Engineering
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,
THE OBJECT-ORIENTED DESIGN WORKFLOW UML2 Sequence Diagrams.
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
7. 2Object-Oriented Analysis and Design with the Unified Process Objectives  Detailed Object-Oriented Requirements Definitions  System Processes—A Use.
SE-565 Software System Requirements More UML Diagrams.
Coming up: Interaction Diagrams
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”
System Sequence Diagrams
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
By: Muhammad Aamir Salem
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.
Systems Analysis and Design in a Changing World, 6th Edition
1 Sequence Diagrams (Based on Stevens and Pooley (2006, Chapters 9, 10) and Fowler (2004, Chapter 4)) David Meredith Aalborg University.
UML January 26, 2011 CSE 403, Winter 2011, Brun UML Sequence Diagrams.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
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.
Sequence diagram in UML Martin Palkovik. Sequence diagram  It is a graphic representation of system operations based on chronology - a time sequence.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Drawing System Sequence Diagrams
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.
Use Case Driven Analysis Requirements Use Case Use Case Description System Sequence Diagram Chapter 5.
System Sequence Diagrams Tutorial. Use-Case for Monopoly game Monopoly game Use Case UC1: Play Monopoly Game Scope: Monopoly application Level: user goal.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
UNIFIED MODELING LANGUAGE(UML) BY Touseef Tahir Lecturer CS COMSATS Institute of Information Technology, Lahore.
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.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Chapter 3: Introducing the UML
CSE 403 Lecture 8 UML Sequence Diagrams Reading: UML Distilled, Ch. 4, M. Fowler slides created by Marty Stepp
 The Sequence Diagram models the collaboration of objects based on a time sequence.  It shows how the objects interact with others in a particular scenario.
More on UML 1. 1.Use-case diagram 2.Class diagram [Object diagram] (static) 1.1 Domain/analysis model – of reality 1.2 Design model – of decisions 3.
Basics of RSA Rational Software Architect. What is RSA? Comprehensive Modeling and Development environment that leverages the Unified Modeling Language.
Sequence Diagram Lecture # 1. Sequence Diagram Definition A Sequence diagram is an interaction diagram that shows how the objects and classes involved.
Sequence Diagram.
Standard UML: Communication and Dynamic Behavior
UML SEQUENCE DIAGRAM.
UML Modeling Sequence diagram
Unified Modeling Language
UML UML Sequence Diagrams CSE 403
Object-Oriented Systems Analysis and Design Using UML
Prepared By Sidra Noureen
Business System Development
Sequence Diagrams.
Object Oriented Analysis and Design
Superior University, Lahore
CIS 375 Bruce R. Maxim UM-Dearborn
Unified Modelling Language
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Interaction diagrams Interaction diagrams are models that describe how groups of objects collaborate in some behavior. Typically, an interaction diagram.
Use Case Model Use case diagram – Part 2.
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
CIS 375 Bruce R. Maxim UM-Dearborn
Appendix 3 Object-Oriented Analysis and Design
Midterm Review CSCI 360, Dr. X.
Presentation transcript:

Sequence Diagram Tutorial From: UML Distilled, Third Edition, Chapter 4 M. Fowler

Use Cases and Scenarios A use case is a collection of interactions between external actors and a system In UML, a use case is “the specification of a sequence of actions, including variants, that a system (or entity) can perform, interacting with actors of the system.” Typically each use case includes a primary scenario ( or main course of events) and zero or more secondary scenarios that are alternative courses of events to the primary scenario. In RUP (Rational Unified Process), user requirements are captured as use cases that are refined into scenarios. Then: A scenario is one path or flow through a use case that describes a sequence of events that occurs during one particular execution of a system.

Emphasis on time ordering! UML Sequence Diagrams Describe the flow of messages, events, actions between objects Show concurrent processes and activations Show time sequences that are not easily depicted in other diagrams Typically used during analysis and design to document and understand the logical flow of your system Emphasis on time ordering!

Sequence Diagram 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)

Sequence Diagram (make a phone call) Caller Phone Recipient Picks up Dial tone Dial Ring Ring notification Sequence diagrams generally show the sequence of events that occur Picks up Hello Hello

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

Messages Between Objects messages (method calls) indicated by arrow to other object write message name and arguments above arrow

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

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

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

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]

Sequence diagram from use case scenario

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)

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.

Poker sequence diagram

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?

Poker Sequence Diagram 2