System Sequence Diagrams

Slides:



Advertisements
Similar presentations
Chapter 15 UML Interaction Diagrams 1CS6359 Fall 2012 John Cole.
Advertisements

©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
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.
Ana M. Fernández  A UML diagram that depicts: ◦ interactions between objects. ◦ how the business currently works by showing how various.
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
Chapter 15 Interaction Diagrams. Most Common Sequence Diagram Communication Diagram Sequence Diagrams illustrate interactions between classes of a program.
SE-565 Software System Requirements More UML Diagrams.
Designing with Interaction and Design Class Diagrams Chapters 15 & 16 Applying UML and Patterns Craig Larman With some ideas from students in George Blank’s.
SENG 403 SENG 403 – Winter  Brief introduction to SSD  Example (A sales systems (Cashier))  Example (Monopoly game) SENG 403 – Winter 2012.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Object-Oriented Analysis and Design Feb 9, 2009.
CSSE 374: Interaction Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812) These slides and others derived.
CS3773 Software Engineering
Interactions. 2 Objects communicate with each other by sending messages. Sending a message is another name for a member function call. –Some C++ examples.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
1 SAD2 - UML 2 nd Lecture Sequence Diagram and other dynamic views Lecturer: Dr Dimitrios Makris
Introduction to Interaction Diagrams Used to illustrate the dynamic behaviour of a community of objects that collaborate by passing messages in order to.
1 On to Object Design Chapter 14 Applying UML and Patterns.
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.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Sequence Diagrams.
BTS430 Systems Analysis and Design using UML Interaction Diagrams.
Copyright © Hsiao-Lan Wei All Rights Reserved Design Model Interaction diagram.
Starting Object Design
Chapter 4: UML Interaction Diagrams. Objective Provide a reference for frequently used UML interaction diagram notation- sequence and communication diagrams.
Lecture 18: Object-Oriented Design – Interaction and State Diagrams Anita S. Malik Adapted from Schach (2004) Chapter 12.
Design Class Diagrams (DCDs)
Chapter 16 Applying UML and Patterns Craig Larman
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
What to remember from Chap 13 (Logical architecture)
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Interaction Diagram Notation
Object-Oriented Analysis and Design Feb 11, 2009.
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.
1 On To Object Design Chapter 14 Applying UML and Patterns -Craig Larman.
CSCI-383 Object-Oriented Programming & Design Lecture 12.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Collaboration diagrams. Purpose A collaboration diagram is an alternate way to show a scenario. A collaboration diagram shows the objects and relationships.
Chapter 16: UML Class Diagrams
SAD2 - UML Lecturer: Dr. Dimitrios Makris 1st Lecture
Chapter 3: Introducing the UML
Communication Diagrams Lecture 8. Introduction  Interaction Diagrams are used to model system dynamics  How do objects change state?  How do objects.
Dr. Kivanc DincerCS319 Week 6 - Oct.17,20051 Chapter 14 Onto Object Design Objectives Understand dynamic and static object design modeling. Try agile modeling,
Sequence diagrams Lecture 5. Main terms  Interaction  Life line  Activation  Executable behavior and derived behavior  Messages  Trajectory  Frame.
UML Diagrams By Daniel Damaris Novarianto S..
Interactions.
UML Interaction Diagrams
GRASP: Visibility and Design
Chapter 11: Collaboration Diagram - PART1
Sequence Diagram.
Sequence Diagram.
UML Diagrams Jung Woo.
UML dynamic Modeling (Behavior Diagram)
Princess Nourah bint Abdulrahman University
UML Sequence Diagrams.
Object Oriented Analysis and Design
Requirements To Design In This Iteration
Princess Nourah bint Abdulrahman University
IMAT5205 Systems Analysis and Design
Communication Diagrams
Unified Modelling Language
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Interaction Diagrams A Lot of UML!
UML Interaction diagrams
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
UML Interaction Diagrams
Chapter 4 Sequence Diagrams
Presentation transcript:

System Sequence Diagrams Chapter 10 System Sequence Diagrams

Fig. 10.1

Fig. 10.2

Fig. 10.3

Fig. 10.4

Fig. 10.5

Chapter 15: UML Interaction Diagrams

15.1 Introduction Interaction diagrams illustrate how objects interact via messages to carry out tasks: they model the dynamic aspect of objects. 2 types of interaction diagrams: Sequence interaction diagrams; Communication interaction diagrams; We will only focus on sequence diagrams.

15.2 Sequence and Communication Diagrams Both kind of diagrams have the same role within the UML. UML modeling tools allow the software engineer to translate one style into the other style : they are equivalent. Hence : use whatever style you like; Sequence diagrams emphasise the order of messages between objects (communication diagrams rely on numbering of the messages); Communication diagrams are more space efficient, especially if many objects are involved; Example of a sequence diagram :

Skeleton sample code for the previous example: public class A { private B myB = new B(); public void doOne() myB.doTwo(); myB.doThree(); } // … Equivalent communication diagram:

Another Sequence Diagram : makePayment Which can be read as follows: The message makePayment is sent to an instance of a Register. The sender is not identified. The Register instance sends the makePayment message to a Sale instance. The Sale instance creates an instance of a Payment.

Code for the makePayment method of the Sale Class: public class Sale { private Payment payment; public void makePayment( Money cashTendered ) payment = new Payment( cashTendered ); //… } // …

15.3 Interaction Diagrams and Class Diagrams Most of the effort during OOD should be spent on creating interaction diagrams not the class diagram: Interaction diagrams are much more valuable : they detail the algorithms for each method; dynamic view; A class diagram is just a summary; static view; it is very easily created after the interaction diagrams; Coding will be much easier from the interaction diagrams since they detail the many design decisions that have been made; class diagrams show the structure of the classes’ organization; Jumping from the analysis to the class diagram directly is hard; Jumping from the class diagram to coding is hard; Interaction diagrams are an intermediary step between analysis and design, and also between design and coding: they are very valuable.

15.4 Common UML Interaction Diagram Notation Lifeline Boxes :

Message syntax : Singleton objects : Examples: return = message(parameter : parameterType) : returnType Examples: initialize(code) Initialize d = getProductDescription(id) d = getProductDescription(id:ItemID) d = getProductDescription(id:ItemID) : ProductDescription Singleton objects : As we will see later when looking at the singleton pattern, it is very common to deal with the case when only one instance of a class will ever be instantiated (never two) in an application. In this case the singleton pattern can be used to gain visibility to the object. In a UML interaction pattern such an object is marked with a ‘1’ in the upper right corner of the lifeline box. See Figure 15.1 for an example.

15.5 Basic Sequence Diagram Notation Messages : Figure 15.1 Singletons in Interaction Diagrams 15.5 Basic Sequence Diagram Notation Messages :

Many of the details of the notation are optional and are only typically shown whenever using a CASE tool to create the diagrams. Optional elements include: The execution specification bar; The solid bar on a found message; The type information of messages; Using an agile approach, it is reasonable not to show these features except maybe the type information which is useful. Message returns : There are two ways to show the return result from a message: Using the message syntax return Var = message(parameter). Using a reply message line at the end of an activation bar. For an example see Figure 15.2

Messages to ‘self’ or ‘this’ : Figure 15.2 : Two Ways to Show a Return Result from a Message Messages to ‘self’ or ‘this’ :

Creation of instances : Typically we use the language independent create message:

Object Lifelines and Object Destruction We may show the explicit destruction of an object

Frames in UML Sequence Diagrams : To allow the visualization of complex algorithms, sequence diagrams support the notion of frames; Frames are regions of the diagrams that have an operator and a guard,. Figure 15.3:

Typical frame operators are: Semantics alt Alternative fragment for mutual exclusion conditional logic expressed in the guards. loop Loop fragment while guard is true. Can also write loop(n) to indicate looping n times. opt Optional fragment that executes if guard is true. par Parallel fragments that execute in parallel. region Critical region within which only one thread can run. Figure 15.3 illustrated the use of a loop frame; Figure 15.4 illustrate the use of an opt frame:

Figure 15.4 Using the opt Frame Figure 15.5 illustrate the use of the alt frame for mutually exclusive alternatives

Iteration Over a Collection : Figure 15.5 Using the alt Frame Iteration Over a Collection : A common algorithm is iterate over all members of a collection (any data structure) sending the same message to each object: See figure 15.6 and 15.7 for possible visual representations

Figure 15.6 Iteration Over a Collection Using Explicit Notation Figure 15.7 Iteration Over a Collection Using Implicit Notation

Nesting of Frames : Frames can be nested:

More Sequence Diagrams and Contracts Chapter 32 More Sequence Diagrams and Contracts

Fig. 32.1

Fig. 32.2

Fig. 32.3