Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.

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

Chapter 15 UML Interaction Diagrams 1CS6359 Fall 2012 John Cole.
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.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
Sept Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Chapter 15 Interaction Diagrams. Most Common Sequence Diagram Communication Diagram Sequence Diagrams illustrate interactions between classes of a program.
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
SE-565 Software System Requirements More UML Diagrams.
Object-oriented design Part 4: More UML. Interfaces An interface is a language construct specific to Java Java does not support multiple inheritance Interfaces.
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.
Object-Oriented Analysis and Design
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”
1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 5a CRC Cards & Sequence Diagrams (Based on Stevens and Pooley (2006, Section.
CSSE 374: Interaction Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812) These slides and others derived.
INFO 620Lecture #51 Information Systems Analysis and Design Sequence and Collaboration Diagrams INFO 620 Glenn Booker.
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.
Interaction diagrams Sequence and collaboration diagrams.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
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.
Copyright 2002 Prentice-Hall, Inc. Chapter 2 Object-Oriented Analysis and Design Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey.
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.
1 UML Sequence Diagrams UML Distilled, Third Edition, Chapter 4 M. Fowler.
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.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Drawing System Sequence Diagrams
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.
Object Oriented Analysis and Design Sequence Diagrams.
1 On To Object Design Chapter 14 Applying UML and Patterns -Craig Larman.
Object-Oriented Analysis and Design CHAPTERS 9, 31: DOMAIN MODELS 1.
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 3: Introducing the UML
 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.
Appendix Object-Oriented Analysis and Design: Use Cases and Sequence Diagrams Modern Systems Analysis and Design Fifth Edition Jeffrey A. Hoffer Joey F.
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.
UML Interaction Diagrams
Chapter 11: Collaboration Diagram - PART1
Sequence Diagram.
Prepared By Sidra Noureen
Sequence Diagram.
Sequence Diagrams.
Object Oriented Analysis and Design
Requirements To Design In This Iteration
Princess Nourah bint Abdulrahman University
System Sequence Diagrams
IMAT5205 Systems Analysis and Design
Week 12: Activity & Sequence Diagrams
Appendix A Object-Oriented Analysis and Design
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Interaction Diagrams A Lot of UML!
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Appendix 3 Object-Oriented Analysis and Design
UML Interaction Diagrams
Presentation transcript:

Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1

What will we learn? UML Interaction Diagrams – What are they, how to create them 2

UML Interaction Diagrams There are two types: Sequence and Communication diagrams We will first look at the notation used to represent these, and then later look at important principles in OO design We’ll look at various examples here to learn how to create the diagrams 3

UML Sequence Diagrams Sequence diagrams are more detailed than communication diagrams They often represent a series of method calls between objects in a system The sequence is represented in what is called “fence format”, and each new object in the sequence is added to the right in the diagram Interactions between objects are usually method calls, but may also be object creation/deletion Especially useful for message flow diagrams, with request-reply pairs 4

Example: Sequence Diagram 5 public class A { private B myB = new B(); Public void doOne() { myB.doTwo(); myB.doThree(); }

UML Communication Diagrams Communication diagrams illustrate object interaction in a graph or network format; objects may be placed anywhere in the diagram 6

Which is best? Depends on the situation; sequence diagrams are mostly preferred because they can capture more detail, but communication diagrams are useful for capturing object interaction on whiteboard or wall sketches Recall that with Agile UP, much of the design is done at the whiteboard in small groups In general, more notational tools are available for sequence diagrams, and it is usually easier to read the call flows Communication diagrams are much easier to edit and change Just add in new objects anywhere Communications diagrams are also much more space efficient One possible approach: Start with communications diagram, and if needed, then develop sequence diagrams 7

Reading a Sequence Diagram We would say “The message makePayment is sent to an instance of Register. The Register instance sends the makePayment message to the Sale instance. The Sale instance creates an instance of a Payment.” Here, “message” is a method call. 8

Reading a Communication Diagram This diagram has the same intention as the sequence diagram on the previous slide. 9

Interaction Diagrams Are Important Often left out in favor of class definition diagrams, but these diagrams are important and should be done early They describe how the objects interact, and may give clues to the operations and attributes needed in the class diagrams These diagrams are part of the Design Model artifact, and are started in the Elaboration phase in Agile UP 10

Sequence Diagrams: Lifeline Box Notation 11 Basic notation for the entities that make up the sequence diagram – they are called lifeline boxes and represent the participants in the particular sequence being modeled Note that a participant does not need to be a software class, but it usually is for our purposes The standard format for messages between participants is: return = message(parameter: paramerType) : returnType Type information is usually omitted, as are parameters

12

Sequence Diagrams: Messages 13 Messages are notated as solid arrows with filled in arrowheads between lifelines The lifelines are the dotted lines that extend below each participant box, and literally show the lifespan of the participant The first message may come from an unspecified participant, and is called a “found message”. It is indicated with a ball at the source Messages can be synchronous (sender waits until receiver as finished processing the message, and then continues – blocking call) or asynchronous (sender does not wait, more rare in OO designs) Dashed arrow is used to indicate return of control, e.g. after receipt of synchronous message. May contain a value.

14

Sequence Diagrams: Specifics 15 The execution specification bar or activation bar indicates that the operation is on the call stack Usually replies to messages are indicated with a value or a dotted line (see next slide) It is possible to have a message to “self” (or “this”) Sequence diagrams can also indicate instance creation (see later slide) Likewise, instances can be destroyed (indicated by “X” at the end of lifeline)

16

17

Sequence Diagrams: Specifics 18 Diagram frames may be used in sequence diagrams to show: Loops Conditional (optional) messages Nesting (a conditional loop) Relationships between diagrams See next slides for examples

19

20

21

22

Polymorphism and Asynchronous/Synchronous Calls 23 Polymorphism – inheriting an operation from a superclass Can show this by first showing the message to the abstract class, and then breaking out individual diagrams for the sub-classes Asynchronous messages: does not have to wait for response, does not block Initiate new thread of execution Notation: Usually notated with a “stick” arrow, but not always. Often context is clear from the system being modeled

24

25

Communication Diagram Notation 26 For a communication diagram, identify the objects and establish the links between them A link is a connection between objects, indicates some kind of navigation or visibility between objects is possible Use links to list messages that may flow between objects Each message is listed on the link, numbered, with a small arrow to indicate direction There can be multiple messages on the links

Messages in a Communication Diagram 27

Communication Diagram Messages - Notes 28 Usually the starting message is not numbered It is possible to have messages from the object to itself – do this with a link from the object to itself, and notate the message on that link If the message is creating an object, the message is usually named “create” (may include parameters) Sometimes “new” is also used, and also > above the message The messages are numbered to indicate order, and nested messages are normally notated as n.x, where x is the message number in the nested sequence.

Messages Numbering 29

Communication Diagram Messages – Other Qualities 30 A conditional message may be indicated with a condition in square brackets before the message Mutually exclusive conditional paths – two sequence paths depending on a condition Looping can also be shown Like sequence diagrams, multiple communication diagrams can be used to indicate polymorphism Asynchronous calls/messages are usually indicated with stick arrows See following slides for examples

Messages – Conditional and Looping 31

Messages – Mutually Exclusive Conditional Paths 32

Sequence Diagram - Example 33

34

35

36

37

Takeaways from Chapter 15 Understand the basics of reading UML sequence diagrams, and how they show interaction between the objects that make up the system. 38

Next … System Sequence Diagrams – Chapter 10 39