1 CSC 450 Slides adapted from slides created by Robert B. France UML Behavioral Models.

Slides:



Advertisements
Similar presentations
Ana M. Fernández  A UML diagram that depicts: ◦ interactions between objects. ◦ how the business currently works by showing how various.
Advertisements

© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
Sequence Diagrams. Introduction A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and.
1 Chapter 4 Dynamic Modeling and Analysis (Part I) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence.
Interaction Diagrams Activity Diagram State Machine Diagram
THE OBJECT-ORIENTED DESIGN WORKFLOW UML2 Sequence Diagrams.
7M822 UML Sequence Diagrams 2 December 2010.
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
© 2005 Prentice Hall4-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
OOAD Using the UML - Use-Case Analysis, v 4.2 Copyright  Rational Software, all rights reserved 1 Interaction Diagrams.
Object Interaction Models - Review The use case and its scenarios serve as a vehicle for organizing the object interactions that take place. Each scenario.
7M822 UML Interaction Diagrams 25 November 2010.
Modeling Dynamic Behavior: Sequence and Collaboration Diagrams.
SE-565 Software System Requirements More UML Diagrams.
1 Lab Beginning Analysis and Design 4 Completion of first version of use case diagram initiates the processes of analysis and design. 4 UML provides.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Sequence Diagram Tutorial
CS3773 Software Engineering
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
Modelling Interactions and Behaviour. © Lethbridge/Laganière 2005 Chapter 8: Modelling Interactions and Behaviour2 Interaction Diagrams Interaction diagrams.
מידול התנהגותי 1. Today’s Session Sequence Diagrams State Machines 2.
Interaction diagrams Sequence and collaboration diagrams.
UML / UML 2.0 Diagrams (Part III) 1. Sequence diagram is the most common kind of interaction diagram. It focuses on the message interchange between a.
Introduction to Interaction Diagrams Used to illustrate the dynamic behaviour of a community of objects that collaborate by passing messages in order to.
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.
Use Cases 7/09. lnot part of the system lrepresents roles a user can play lrepresents a human, a machine or another system lactively exchanges information.
Interaction Models (2): Sequence Diagrams Extracted from textbook: Object Oriented Modeling and Design with UML M. Blaha, J. Rumbaugh 1.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Sequence Diagrams.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
1 Devon M. Simmonds University of North Carolina, Wilmington CSC450 Software Engineering WorkFlow Modeling with Activity Diagrams.
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.
Information Systems Engineering Interaction Diagrams: Sequence Diagram Collbortion Diagram.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
© 2008 Prentice Hall, Ovidiu Noran Lecture 7b 1 Modelling OO Logic Requirements: Sequence Diagrams and Activity Diagrams (Textbook Chapter 8, Appendix)
Interaction Diagrams Interaction Diagrams allow the designer to show how groups of objects collaborate in some behavior. –Interaction Diagrams will show.
Sequence Diagrams Sequence; Interaction Diagrams Behavioral Diagrams
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour UML Sequence Diagram.
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 communication and sequence diagrams : listCampaigns *[For.
Object-Oriented Analysis and Design 1 Mira Balaban & Arnon Sturm Object-Oriented Analysis and Design Session 3a: Behavioral Modeling - Interactions.
Sequence Diagrams CSIS3600. Sequence Diagrams A sequence diagram shows an interaction arranged in time sequence. In particular, it shows the objects participating.
(c) Addison Wesley Copyright © 2000 by Addison Wesley Version 1.0
UNIFIED MODELING LANGUAGE(UML) BY Touseef Tahir Lecturer CS COMSATS Institute of Information Technology, Lahore.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 5 INTRODUCTION TO SYSTEMS ANALYSIS AND DESIGN: AN AGILE, ITERATIVE APPROACH CHAPTER.
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”
Slide 1 CSC450 Review & Summary Slides adapted from various sources.
CS212: Object Oriented Analysis and Design Lecture 32: Use case and Class diagrams.
State Modeling. Events An event is an occurrence at a point in time, such as user depresses left button or.
1 LAB What is Collaboration diagram? 4 Collaboration diagrams illustrate the interaction between the objects, using static spatial structure. 4.
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.
Appendix Object-Oriented Analysis and Design: Use Cases and Sequence Diagrams Modern Systems Analysis and Design Fifth Edition Jeffrey A. Hoffer Joey F.
Sequence diagrams Lecture 5. Main terms  Interaction  Life line  Activation  Executable behavior and derived behavior  Messages  Trajectory  Frame.
Systems Analysis and Design in a Changing World, 6th Edition
Interaction View.
Subject Name: Object oriented Modeling and Design
Prepared By Sidra Noureen
Sequence Diagram.
UML Sequence Diagrams.
Object Oriented Analysis and Design
Princess Nourah bint Abdulrahman University
Systems Analysis and Design in a Changing World, 6th Edition
Interaction diagrams.
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.
UML Interaction diagrams
Presentation transcript:

1 CSC 450 Slides adapted from slides created by Robert B. France UML Behavioral Models

Advanced Modeling with UML2 Behavioral Elements of UML Metamodel

3 Specifying behavior using UML Class models describe objects and their relationships Behavior can be specified in terms of operation pre and postconditions, but behavior is not the primary focus of a class model Behavioral models in the UML State models: describe control aspects of a system – provides descriptions sequences of operations without regard for what the operation do. Interaction models: describe interactions among objects Activity models: description of a behavioral feature expressed in terms of sequences of steps.

4 How things happen in the UML An action is executed by an object It May Change the contents of one or more variables Invoke an operation on another object Send a signal to another object Either one will eventually cause the execution of a procedure on the target object… …which will cause other actions to be executed, etc. Successor actions are executed Determined either by control flow or data flow

5 Sequence Models

6 Overview Objects interact to accomplish use case goals. Object interactions are described in terms of Collaborations: descriptions of object structures that support required behaviors Interactions: descriptions of communication structures that support required behaviors A sequence diagram Models sequential logic, an ordered sequence of interactions between objects as described for example, by a use case Interaction/sequence diagrams allow one to view only the parts of a system involved in accomplishing use case goals.

7 A class diagram for a Student Registration Application ***** ****** * CourseSection requestToRegister Registration Course getPrerequisite Student addToSchedule hasPassedCourse addToRegistrationList Diagram shows structure not behaviour.

8 Sequence diagrams A sequence diagram shows the sequence of messages exchanged by the set of objects performing a certain task The objects are arranged horizontally across the diagram. An actor that initiates the interaction is often shown on the left. The vertical dimension represents time. A vertical line, called a lifeline, is attached to each object or actor. The lifeline becomes a broad box, called an activation box during the live activation period. A message is represented as an arrow between activation boxes of the sender and receiver. A message is labelled and can have an argument list and a return value. requestToRegister addToSchedule > :Student :Registration :CourseSection addToRegistrationList

9 Sequence Diagram: basic constructs objectName : Class object symbol lifeline activation other:Type message name (…) return : Class create new (…) delete m1()

10 Different kinds of arrows Synchronous - Procedure call or other kind of nested flow of control Asynchronous, flat flow Return

11 Example: different arrows callerexchangecallee Flat Flow lift receiver dial tone dial digit ringing toneringing signal lift receiver teller: Order: Article Nested Flow getValue price getName Different traces are possible!

12 Extended sequence diagram example requestToRegister(aStudent) addToSchedule() aStudent: Student :Registration :CourseSectionGUI requestToRegister() :Course [hasPrerequisite] > prereq := getPrerequisite() hasPrerequisite:= hasPassedCourse(prereq) addToRegistrationList()

13 If an object’s life ends, this is shown with an X at the end of the lifeline Sequence diagrams – an example with object deletion cancelBooking deleteFromItinerary cancel :PassengerRole :Booking:SpecificFlight deleteFromPassengerList

14 A more complex Sequence Diagram (UML 2.0) Frame and Name Lifeline is an object Interaction Occurrence Combined Fragment Plain asynchronous message

15 Combined Fragments A combined fragment defines an expression of interaction fragments. A combined fragment is defined by an interaction operator and corresponding interaction operands. Through the use of CombinedFragments the user will be able to describe a number of traces in a compact and concise manner – UML Spec.

16 Combined Fragment

17 Combined fragment interaction operators Alternatives (alt) choice of behaviors – at most one will execute depends on the value of the guard (“else” guard supported) Option (opt) Special case of alternative Break (break) Represents an alternative that is executed instead of the remainder of the fragment (like a break in a loop) Parallel (par) Concurrent (interleaved) sub-scenarios Negative (neg) Identifies sequences that must not occur

18 Combined fragment interaction operators Critical Region (region) Traces cannot be interleaved with events on any of the participating lifelines Loop (loop) Optional guard: [,, ] No guard means no specified limit

19 Critical region call(112)

20 Combined fragments and data: loop loop Choice Operand Separator Guarding InteractionOperand with an InteractionConstraint

21 sd ATM-transaction client:atm:dbase: Referencing interaction diagrams insertCard CheckPin ref alt [chk= OK] [else] error(badPIN) DoTransaction ref sd CheckPin client:atm:dbase: askForPIN data(PIN) check(PIN) result(chk) Interaction Frame Lifeline is one object or a part Interaction Occurrence Combined (in-line) Fragment

22 Decomposition with global constructs corresponding to those on decomposed lifeline Decomposed lifeline Detailed context Decomposing Lifelines

23 Local variables: money transfer sequence diagram Local variables

24 Creating Interaction Model Set interaction context Use Case scenario Identify (controller) object responsible for handling the event initiating the interaction Identify objects that collaborate with the controller (collaborators). Specify message passing sequence that handles the initiating message.

25 Interaction modeling tips Set the context for the interaction. Include only those attributes of the objects that are relevant. Express the flow from left to right and from top to bottom. Put active objects to the left/top and passive ones to the right/bottom. Use sequence diagrams to show the explicit ordering between the stimuli when modeling real-time

26 Example 1: problem specification Withdrawing money from an account When withdrawing money from his account, John inserts his card and inputs his password. He then selects the account from which to withdraw money and enters the amount of money to withdraw. He then collects his money and receipt.

27 Exercise: create a sequence diagram for a scenario of a self- service machine. The main functions of a self-service machine is to allow a customer to buy a product(s) from the machine (candy, chocolate, juice...). A customer wants to buy some of the products offered by the self-service machine. First of all he/she inserts money into the machine and selects one or more products. The money travels to the register and the register checks to see whether the selected product is in the dispenser. The register updates its cash reserved and asks the dispenser to deliver the product to the front of the machine.

28 ______________________ Devon M. Simmonds Computer Science Department University of North Carolina Wilmington _____________________________________________________________ Qu es ti ons? The End

Additional Slides 29

Money Withdrawal 30

31 UML Metamodel – Interactions

32 UML Metamodel – Interactions

33

34

35 Interaction Use

36 A simple sequence diagram for a Register Student use case requestToRegister addToSchedule > :Student :Registration :CourseSection addToRegistrationList ***** ****** * CourseSection requestToRegister Registration Course getPrerequisite Student addToSchedule hasPassedCourse addToRegistrationList 1 1 1