© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Sequence Diagrams.

Slides:



Advertisements
Similar presentations
Interaction Design & UML Sequence Diagram
Advertisements

Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
Interaction Diagram Notation From Chapter 15 of Craig Larman, Applying UML and Patterns John Dalesandro.
UML (Sequence Diagrams, Collaboration and State Chart Diagrams) Presentation By - SANDEEP REDDY CHEEDEPUDI (Student No: ) - VISHNU CHANDRADAS (Student.
Ana M. Fernández  A UML diagram that depicts: ◦ interactions between objects. ◦ how the business currently works by showing how various.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Architectural Modeling Notations.
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
THE OBJECT-ORIENTED DESIGN WORKFLOW UML2 Sequence Diagrams.
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.
SE-565 Software System Requirements More UML Diagrams.
SEQUENCE DIAGRAM Prepared by: T. Fatimah Alageel.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
CS3773 Software Engineering
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
1 CSC 450 Slides adapted from slides created by Robert B. France UML Behavioral Models.
Interaction diagrams Sequence and collaboration diagrams.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
Introduction to Interaction Diagrams Used to illustrate the dynamic behaviour of a community of objects that collaborate by passing messages in order to.
System Sequence Diagrams. Recap When to create SSD? How to identify classes/instances? Use case descriptions UML notations for SSD.
Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna,
Chapter 5 – System Modeling
1 On to Object Design Chapter 14 Applying UML and Patterns.
1 Sequence Diagrams (Based on Stevens and Pooley (2006, Chapters 9, 10) and Fowler (2004, Chapter 4)) David Meredith Aalborg University.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
Interaction Models (2): Sequence Diagrams Extracted from textbook: Object Oriented Modeling and Design with UML M. Blaha, J. Rumbaugh 1.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
Chapter 4: UML Interaction Diagrams. Objective Provide a reference for frequently used UML interaction diagram notation- sequence and communication diagrams.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML Class Diagrams.
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.
 C-style pointer-based arrays  Have great potential for errors and several shortcomings  C++ does not check whether subscripts fall outside the range.
Interaction Diagram Notation
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour UML Sequence Diagram.
Object-Oriented Analysis and Design 1 Mira Balaban & Arnon Sturm Object-Oriented Analysis and Design Session 3a: Behavioral Modeling - Interactions.
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Activity Diagrams.
CSCI-383 Object-Oriented Programming & Design Lecture 12.
Java™ How to Program, Early Objects Version, 8/e © by Pearson Education, Inc. All Rights Reserved.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Sections © Copyright by Pearson Education, Inc. All Rights Reserved.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML State Diagrams.
Chapter 3: Introducing the UML
Sequence Diagram SAD ::: Fall 2015 Sabbir Muhammad Saleh.
Communication Diagrams Lecture 8. Introduction  Interaction Diagrams are used to model system dynamics  How do objects change state?  How do objects.
1 Kyung Hee University Interaction Diagrams Spring 2001.
Project 2: Phase 1 Submission 7 Late submissions 10% 10 No submissions 14% Better than project 1 phase 3 submissions 10-point bonus: If you catch the deadline.
Sequence diagrams Lecture 5. Main terms  Interaction  Life line  Activation  Executable behavior and derived behavior  Messages  Trajectory  Frame.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Activity Diagrams.
Chapter 11: Collaboration Diagram - PART1
Sequence Diagram.
Prepared By Sidra Noureen
Sequence Diagram.
Expressions and Control Flow in JavaScript
Sequence Diagrams.
UML Sequence Diagrams.
Object Oriented Analysis and Design
Princess Nourah bint Abdulrahman University
System Sequence Diagrams
Classification of UML Diagrams
Interaction diagrams.
Unified Modelling Language
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Interaction Diagrams A Lot of UML!
UML Interaction diagrams
Chapter 6 Control Statements: Part 2
Chapter8: Statement-Level Control Structures April 9, 2019
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
UML Interaction Diagrams
Presentation transcript:

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Sequence Diagrams

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2 Objectives  To present the UML sequence diagram notation  To illustrate uses of sequence diagrams  To present heuristics for making good sequence diagrams  To discuss when to use sequence diagrams

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 3 Topics  UML interaction diagrams  Frames, lifelines, and messages  Combined fragments  Sequence diagram heuristics  Using sequence diagrams

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4 Interaction Diagrams An interaction diagram is a notation for modeling the communication behavior of individuals exchanging information to accomplish some task. Sequence diagram—shows interacting individuals along the top and message exchange down the page Communication diagram—shows messages exchanged on a form of object diagram Interaction overview diagram—a kind of activity diagram whose nodes are sequence diagram fragments Timing diagram—shows individual state changes over time

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5 Sequence Diagram Frames Frame—a rectangle with a pentagon in the upper left-hand corner called the name compartment. sd interactionIdentifier interactionIdentifier is either a simple name or an operation specification as in a class diagram

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6 Lifelines  Participating individuals are arrayed across the diagram as lifelines: Rectangle containing an identifier Dashed line extending down the page  The vertical dimension represents time; the dashed line shows the period when an individual exists.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7 Lifeline Creation and Destruction  An new object appears at the point it is created. Not clear from UML specification  A destroyed object has a truncated lifeline ending in an X.  Persisting objects have lifelines that run the length of the diagram.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 8 Lifelines Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 9 Lifeline Identifier Format  name—simple name or “self”; optional  selector—expression picking out an individual from a collection Format not specified in UML Optional; if omitted, so are the brackets  typeName—Type of the individual Format not specified in UML Optional; if omitted, so is the colon  Either name, typeName, or both must appear name[ selector ] : typeName

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10 Lifeline Identifier Examples  player[i] : Player  player[i]  : Player  board

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11 Self Used when the interaction depicted is “owned” by one of the interacting individuals

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 12 Messages and Message Arrows  Synchronous—The sender suspends execution until the message is complete  Asynchronous—The sender continues execution after sending the message  Synchronous message return or instance creation

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 13 Message Arrow Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 14 Message Specification Format  variable—simple name of a variable assigned a result Optional; if omitted, so is the equals sign  name—simple name of the message  argumentList—comma-separated list of arguments in parentheses varName = paramName  = paramName may be omitted paramName = argumentValue  = argumentValue may be omitted — Optional; parentheses may appear even if omitted  Message specification may be * (any message) variable = name argumentList

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 15 Message Specification Examples  hello  hello()  msg = getMessage( helloMessage )  x = sin( a/2 )  x = sin( angle = a/2 )  trim( result = aString )  Note that assigning a value to a parameter and assigning a returned value to a variable cannot be distinguished.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 16 Execution Occurrences  An operation is executing when some process is running its code.  An operation is suspended when it sends a synchronous message and is waiting for it to return.  An operation is active when it is executing or suspended.  The period when an object is active can be shown using an execution occurrence. Thin rectangle over lifeline dashed line

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 17 Execution Occurrence Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 18 Combined Fragments  A combined fragment is a marked part of an interaction specification that shows Branching, Loops, Concurrent execution, And so forth.  It is surrounded by a rectangular frame. Pentagonal operation compartment Dashed horizontal line forming regions holding operands

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 19 Combined Fragment Layout

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 20 Optional Fragment  A portion of an interaction that may be done Equivalent to a conditional statement Operator is the keyword opt Only a single operand with a guard  A guard is a Boolean expression in square brackets in a format not specified by UML. [else] is a special guard true if every guard in a fragment is false.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 21 Optional Fragment Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 22 Alternative Fragment  A combined fragment with one or more guarded operands whose guards are mutually exclusive Equivalent to a case or switch statement Operator is the keyword alt

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 23 Alternative Fragment Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 24 Break Fragment  A combined fragment with an operand performed in place of the remainder of an enclosing operand or diagram if the guard is true Similar to a break statement Operator is the keyword break

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 25 Break Fragment Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 26 Loop Fragment  Single loop body operand that may have a guard  Operator has the form loop( min, max ) where Parameters are optional; of omitted, so are the parentheses min is a non-negative integer max is a non-negative integer at least as large as min or *; max is optional; if omitted, so is the comma

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 27 Loop Fragment Execution Rules  The loop body is performed at least min times and at most max times.  If the loop body has been performed at least min times but less than max times, it is performed only if the guard is true.  If max is *, the upper iteration bound is unlimited.  If min is specified but max is not, then min=max.  If the loop has no parameters, then min=0 and max is unlimited.  The default value of the guard is true.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 28 Loop Fragment Example

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 29 Sequence Diagram Heuristics 1  Put the sender of the first message leftmost.  Put pairs of individuals that interact heavily next to one another.  Position individuals to make message arrows as short as possible.  Position individuals to make message arrows go from left to right.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 30 Sequence Diagram Heuristics 2  Put the self lifeline leftmost.  In a sequence diagram modeling an operation interaction, draw the self execution occurrence from the top to the bottom of the diagram.  Name individuals only if they are message arguments or are used in expressions.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 31 Sequence Diagram Heuristics 3  Choose a level of abstraction for the sequence diagram.  Suppress messages individuals send to themselves unless they generate messages to other individuals.  Suppress return arrows when using execution occurrences.  Don’t assign values to message parameters by name.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 32 Using Sequence Diagrams  Sequence diagrams are useful for modeling Interactions in mid-level design; The interaction between a product and its environment (called system sequence diagrams); Interactions between system components in architectural design.  Sequence diagrams can be used as (partial) use case descriptions.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 33 Summary 1  Sequence diagrams are a powerful UML notation for showing how objects interact.  Interacting objects are represented by lifelines arrayed across the diagram.  Time is represented down the diagram.  The exchange of messages is shown by message arrows arranged down the diagram.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 34 Summary 2  Interaction fragments show flow of control and concurrency. Optional Alternative Break Loop Others  Sequence diagrams are useful in product design, architectural design, and mid-level detailed design.