Standard UML: Communication and Dynamic Behavior

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.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
Information System Design IT60105
1 UML--definition UML: stands for "unified modeling language” unifies methods of Booch, Rumbaugh (OMT or Object Modeling Technique), and Jacobson (OOSE.
1 Building an Analysis Model of the System Under Development.
1 SWE Introduction to Software Engineering Lecture 25 – Object-Oriented Design (Chapter 14)
Software modeling for embedded systems: static and dynamic behavior.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
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.
SEQUENCE DIAGRAM Prepared by: T. Fatimah Alageel.
UML Sequence Diagrams Reading: UML Distilled Ch. 4, by M. Fowler
State and Sequence Diagrams Modelling dynamic information So far we have seen: Use Case Diagrams – requirements capture, interface.
UML for Java Programmers Object Mentor, Inc. Copyright  by Object Mentor, Inc All Rights Reserved
Sequence Diagram Tutorial
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.
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.
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.
Computer Science 340 Software Design & Testing UML Sequence Diagrams.
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.
© 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.
Object Oriented Software Development
Sequence Diagrams CSIS3600. Sequence Diagrams A sequence diagram shows an interaction arranged in time sequence. In particular, it shows the objects participating.
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.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
1 Building an Analysis Model of the System Under Development.
Chapter 3: Introducing the UML
CSE 403 Lecture 8 UML Sequence Diagrams Reading: UML Distilled, Ch. 4, M. Fowler slides created by Marty Stepp
Design Review.
Systems Analysis and Design in a Changing World, Fourth Edition
Sequence Diagram.
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Sequence Diagrams.
Dynamic Modeling of Banking System Case Study - I
UML UML Sequence Diagrams CSE 403
Introduction to Unified Modeling Language (UML)
Object-Oriented Systems Analysis and Design Using UML
Sequence Diagram.
Sequence Diagrams.
Business System Development
UML dynamic Modeling (Behavior Diagram)
Sequence Diagrams.
Object-Oriented Analysis
Interactions.
Princess Nourah bint Abdulrahman University
IMAT5205 Systems Analysis and Design
Week 12: Activity & Sequence Diagrams
Building an Analysis Model of the System Under Development
CIS 375 Bruce R. Maxim UM-Dearborn
Design and Implementation
Unified Modelling Language
Interaction diagrams Interaction diagrams are models that describe how groups of objects collaborate in some behavior. Typically, an interaction diagram.
Dynamic Modeling Lecture # 37.
Interaction Modeling Extracted from textbook:
CHAPTER 2 Object-Oriented Modeling Using UML (Continued)
Decomposing the System
CIS 375 Bruce R. Maxim UM-Dearborn
Appendix 3 Object-Oriented Analysis and Design
Presentation transcript:

Standard UML: Communication and Dynamic Behavior

Collaboration (Object Message) Diagrams UML : Collaboration (Object Message) Diagrams Black Box Testing

UML language contains many methods which will not be covered here. (And some of the methods we are covering are not officially part of UML, although they are often used with UML, e.g., CRC cards). What we have covered so far: use cases, data flow diagrams--for requirements analysis, design specification ER diagrams, CRC cards--for initial design To be covered: collaboration or object-message diagrams, state diagrams, sequence diagrams--for more detailed design and dynamic aspects

Remember: Errors caught at the design stage will be much less costly to fix than errors that make it to the implementation stage, just as errors caught at the specification stage are much easier to fix than errors caught at the design stage. You cannot just write down an ER specification and complete set of CRC cards. Design requires discussion and modification. As you work on the design, you should refer to the specification, including use cases and any additional materials, to check that your design is meeting this specification and to revise and refine the design as necessary. As you work on the ER diagram and CRC cards, you MAY want to revisit the specifications

Additional UML tools we will use: Collaboration or Object message diagrams State diagrams Sequence diagrams These allow us to further refine the design, in preparation for coding.

Collaboration or Object message diagrams: Each “responsibility” on a CRC card will be implemented as one or more functions, with information being shared by the collaborators as needed. The collaboration or object message diagram makes each information-sharing event explicit, by showing the flow of function calls or “messages” related to that event, and gives a more precise way to check on the design being constructed. Collaboration diagrams make explicit the communications specified through the ER diagram and the CRC cards They also help to define Black Box tests (Not ALL functions need to be diagrammed this way, if the information-sharing mechanism is simple and obvious.) Note: what differences are there between hardware-level communications and software-level communications?

Information Sharing options (software?): In a collaboration or object message diagram we use a rectangle to represent each participating object (labeled by object name or by class name: object name) and we denote each function call by a labeled line or arrow from the calling object to the object responsible for carrying out the function. These calls can be sequentially numbered. These connecting lines can also be labeled to show the status of the objects carrying out the functions in question. Labels used are: S--the object itself F--data field of the object itself P--procedure parameter G--global variable L--local variable

Example: A contrived but instructive example in Practical Object-Oriented Development in C++ and Java by Cay Horstmann (Wiley 1997) considers the case where an object of class Car must carry out the operation add_gas by accessing an object from class GasStation. Note: what would be the relationship of Car and GasStation in the ER diagram? This example can be used to show the differences in the cases above, as follows:

buy_gas void Car::add_gas(GasStation& station) { station.buy_gas(…); } //add_gas has procedure parameter of type //GasStation buy_gas void Car::add_gas( ) { the_gas_station.buy_gas(…); //there is ONE global gas station buy_gas void Car::add_gas( ) { _my_gas_station -> buy_gas(…); //car has ptr to its "own" station, a field in //the “car” object Car GasStation: station P Associated test(s) = ? Car GasStation: the_gas_station G Associated test(s) = ? Car GasStation: _my_gas_station F Associated test(s) = ?

buy_gas void Car::add_gas( ) {GasStation* station = new GasStation( ); station -> buy_gas(…); delete station; } //"build and destroy a station” (local variable) 2. buy_gas void Car::add_gas( ) {GasStation* station = find_gas_station(); //Car class has a “find_gas_station” 1.find_gas_station //operation which it must ask itself to //carry out; the return value, of type //GasStation, is a local variable Car GasStation: station L Associated test(s) = ? Car L GasStation: station S Associated test(s) = ?

Here is another example, also taken from Horstmann, which is more realistic. This diagram shows the messages necessary to execute the "process_dialing" operation in a mail system. Note that "receive_message" can be carried out in two ways, depending on whether the message is for the administrator or for a general reader. The steps to be carried out are: 1. Read input 2a. If input is 9999, have administrator mailbox receive message. 2b1. If input is another extension, find the mailbox for that extension. 2b2. Have that mailbox receive a message.

InputReader process_dialing 1. read_input MailSystem G S 2a. receive message 2b1. locate mailbox AdminMailbox F 2b2. receive message L Mailbox Steps: 1. read_input 2. receive message (case a or case b)

Example: In the bank example, what are examples of appropriate communication mechanisms and associated black box tests For each module Between modules? 1.____________ 2.____________ 3.____________ 4.____________ 5.____________ 6.____________ 7.____________ 8.____________ 9.____________ Event Departure Arrival Customer Bank EventQueue Simulation Bank Statistics 9 8 1 7 6 2 4 5 3

Example: What about the “safe-home” system? What modules might there be? What will be the responsibilities of each module? What communication is needed? What if we add other features, such as environmental modeling?

UML—Modeling Dynamic Behavior: State and Sequence Diagrams (replacements for “flow charts”)

State Diagram: another way of adding detail to the design--models dynamic behavior describes all the possible states a particular object can be in and how that object's state changes as a result of events that affect that object usually drawn for a single class to show behavior of a single object used to clarify dynamic behavior within the system, as needed

A state diagram contains a "start" point, states, and transitions from one state to another. Each state is labeled by its name and by the activities which occur when in that state. Transitions can have three optional labels: Event [Guard] / Action. A transition is triggered by an Event. If there is no Event, then the transition is triggered as soon as the state activities are completed. A Guard can be true or false. If the Guard is false, the transition is not taken. An Action is completed during the transition.

Example: this state diagram example for an "order" in an order-processing system is from Fowler and Scott, UML Distilled (Addison-Wesley, 1997): start /get first item [not all items checked] /get next item [all items checked && all items available] Dispatching Checking initiate delivery check item [all items checked && some items not in stock] delivered item received [all items in stock] Delivered Waiting item received [some items not in stock]

Sequence Diagram: a sequence diagram also models dynamic behavior typically a sequence diagram shows how objects act together to implement a single use case messages passed between the objects are also shown sequence diagrams help to show the overall flow of control in the part of the program being modeled they can also be used to show: concurrent processes asynchronous behavior

Objects in the sequence diagram are shown as boxes at the top below each object is a dashed vertical line--the object’s “lifeline” an arrow between two lifelines represents each message arrows are labeled with message names and can also include information on arguments and control information two types of control: condition, e.g., [is greaterthan zero] iteration, e.g., *[for all array items] “return” arrows can also be included

Example from Fowler and Scott, UML Distilled (note: dashed horizontal line denotes “return”): an Order Entry window an Order an Order Line a Stock Item prepare() *[for all order lines] prepare() hasStock:=check() [hasStock] remove() needsReorder := needsToReorder() [needsReorder] new a Reorder Item a Delivery Item [hasStock] new

Questions: What needs to be added to deal with hardware? What needs to be added to deal with real-time systems and scheduling?