You are on page 1of 43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Chapter 7
Understanding Dynamic Modeling
An object-oriented design should represent the structural and behavioral aspects of a software system. Static modeling is used to represent the structural constituents of a software system. Dynamic modeling is used to represent the behavior of the structural constituents. Dynamic modeling uses various types of diagrams, such as interaction, state, and activity diagrams. This chapter explains the concept of dynamic modeling. In addition, it explains how to create the dynamic model of a system by using interaction diagrams.

Objectives
In this chapter, you will learn to: Identify the concepts of dynamic modeling Create interaction diagrams

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

1/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Introducing Dynamic Modeling Concepts


Dynamic modeling is a UML modeling technique that represents the behavior of the static constituents of a software system. Therefore, it is also known as behavioral modeling. A designer requires dynamic modeling techniques to represent the interaction, workflow, and different states of the static constituents in a software system.

Need for Dynamic Modeling


The design of a software system is considered to be the good if it is able to represent what a system should do and how. Without a good design a developer will not be able to code a program correctly. This is because coding involves the implementation of the design. Modeling techniques are required to represent all aspects of a software system. These modeling techniques help in representing the system requirements, the static constituents of a system, its behavior, and architecture. Dynamic modeling techniques help the designer to represent the behavior of the static constituents so that a developer is able to depict how a system should behave to meet the desired requirements. It provides various diagrams such as, interaction, activity, and state diagrams, which help you design the dynamic model of a software system. Consider the example of Wilson Inc., an automobile manufacturing company, which is planning expansion and, for this reason, wants to automate its inventory control. The management of Wilson Inc. decides to install an Inventory Management System (IMS) that will organize the stock reorder level, supplier details, and payments for spare parts records. The task of developing the IMS is entrusted upon a development team that creates a dynamic model of the IMS to understand the interaction between the various components of the software system. The dynamic model of the IMS is created using various diagrams, such as interaction, state, and activity diagrams. The interaction diagram models the interaction between the static constituents of a software system. The activity diagrams represent the sequence of activities that the static constituents of a system need to perform to complete a process and the state diagrams depict the changes that occur in the state of objects because of the interaction among the various constituents of a software system.

Difference between Static and Dynamic Modeling


Static modeling is required to represent the physical structure of a software system. However, it is insufficient as it does not explain how the constituents of the structure behave and interact with each other. To depict the behavior of the structural constituents, you need dynamic modeling. The following table lists the differences between static and dynamic modeling. Static Modeling It represents the static or structural
www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

Dynamic Modeling It represents the behavior of static constituents


2/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

constituents of a software system. Therefore, it is also known as structural modeling. It includes class and object diagrams. It helps in depicting the relationships and dependencies between the constituents of a system.

of a software system. Therefore, it is also known as behavior modeling. It includes interaction, activity, and state diagrams. It helps in expressing and modeling the behavior of a system over a period of time.

Difference Between Static and Dynamic Modeling

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

3/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Creating Interaction Diagrams


Interaction diagrams depict how the constituents of a software system interact to realize the use cases of the system. In addition, you can use interaction diagrams to generate executable code through forward and reverse engineering. The two components of an interaction diagram are: Collaboration: Depicts the static aspect of an interaction diagram. Interaction: Depicts the dynamic aspect of an interaction diagram. A collaboration is a collection of instances of classes, the relationship among the instances of classes, and actors. A collaboration groups all the components that are required to realize a use case. The relationships among the components of a collaboration are graphically depicted as links between objects. A link serves as a path over which messages are sent and received.

Although, abstract classes and interfaces do not have instances, they can form a part of a collaboration.
You use interactions to depict the flow of control in an operation or among use cases. In an interaction, an object sends a message to request another object to perform an operation. In other words, an interaction is initiated when one object requests another object to perform certain operations, and in this way, invokes its methods. For example, Wilson Inc. has an inventory database that stores the inventory information when a new stock of automobile parts arrives. The inventory manager intimates the supplier and orders automobile parts when the stock of a part reaches its reorder level. To design the IMS, the development team creates a collaboration for the use case, order parts, which is realized through the interaction of Order object and the inventory database. The various interactions to realize the use case, order parts are: 1. Request by the Inventory Manager actor to the object, O 1of class O r d e r , to perform the operation, i s s u e O r d e r ( ) . 2. Request by the i s s u e O r d e r ( )operation to the database to store the information about the order. 3. Signal sent by the database to the object, O 1 , to intimate that the data storage operation is complete. The following figure shows the flow of control to realize the order parts use case of the IMS.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

4/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

There are multiple slots in a collaboration, called roles, which are filled by objects and links at run time. In other words, roles are used to depict the run-time responsibility of the objects of a class and the relationship. The two types of roles in a collaboration are: Classifier roles : Describe objects that can form a part of the collaboration. Association roles : Describes the links that can form a part of the collaboration.

An interaction signifies the collection of communications that occur among the classifier roles across the association roles. A collection of communications indicates the messages that flow from one classifier role to another.
When an object calls the methods of another object, a sequence of messages flow between them. The following table lists the various types of messages that can be sent from one object to another and their graphical representation in an interaction diagram.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

5/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

The commonly used interaction diagrams are Sequence diagram and Communication diagram. Let us, discuss how to create these diagrams.

Creating Sequence Diagrams


Sequence diagrams represent an interaction among objects in the form of messages ordered in a sequence by time. In a sequence diagram, you arrange objects across the x-axis. You place the object that starts an interaction to the extreme left. The objects that come later in the message sequence are placed to the right of the interaction-initiating object. The messages sent and received by the objects in an interaction are placed along the y-axis in an increasing order of time. The following figure depicts the arrangement of objects and messages in a sequence diagram.

An object may be created or destroyed when an operation is performed. You can use sequence diagrams to depict the creation and destruction of an object. In addition, sequence diagrams depict the change in the focus of control of an object in the form of a rectangular bar. The length of rectangle bar represents the duration of time for which an object interacts with another object. The following figure depicts a sequence diagram that shows how an object is created and destroyed, the focus of control, and the object lifeline.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

6/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

For example, in the IMS system, the order object invokes the i s s u e O r d e r ( )method that requests the database to store the information about the order. The following figure depicts the sequence diagram to realize the o r d e rp a r t suse case of the IMS.

When an object invokes its own method or receives a callback from another object, a new focus of control is represented over the existing focus of control and is called a nested focus of control. The following figure shows the nested focus of control of an object.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

7/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Unlike sequence diagrams, communication diagrams do not depict the object lifeline.
In a sequence diagram, the flow of control depicts a sequential flow of messages. However, a programming logic may require you to depict the iterations of messages or the branching of the flow of control. Iterations are repetitions of messages. You can use the following statement to depict an iteration in a sequence diagram: * [j: =1. .n] You use an asterisk, *, to indicate that the message is being sent repeatedly. You can depict iteration by using the following notations: [j < 10]: Specifies that the message will be sent until the value of j is less than 10. [val not found]: Specifies that the message will be sent until val is found. The following sequence diagram depicts that the M a t hobject requests the n u m b e r P r o p e r t i e s object to calculate if a number is prime or not, iteratively.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

8/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Branching of messages occurs when a set of messages responds to a call. The message to be sent is guarded by a condition, which is a Boolean expression. If the condition evaluates to true, then the first message is sent, otherwise, the second message is sent. There is no specification on what type of conditions you may include in your interaction diagrams. You can use either an English language expression or a programming language expression. You can use the following English language expression to depict a condition: [jl e s st h a nz e r o] The following statement shows how you can use a programming language expression to write a condition: [j<=0] To depict the receipt of messages by an object, you can divide the object lifeline into branches. The following figure shows how to divide an object lifeline into branches.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

9/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

For example, in the IMS, the inventory manager checks the reorder level of an automobile spare part before placing an order. If the reorder level condition is true, then the inventory manager places the order for the spare part. If the reorder level condition is false, then the inventory manager checks the information about the last order for the spare part. The following diagram depicts the branching of the flow of control of the O 1object in the P l a c e O r d e ruse case of the order processing system.

Messages in a sequence diagram may be sequenced by giving them a sequence number. Messages can be given names that give a description of the message passing between objects or can be mapped to a method of the called class.
The guidelines that you need to follow when you model a sequence diagram are: Identify the collaboration for an interaction in the system, subsystem, and use cases.
www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm 10/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Identify the objects that have higher responsibility in the interaction. To draw a sequence diagram, place the objects with high responsibility on one side and the low responsibility objects on the other. Identify the lifeline of each object in view of the control to depict the creation and destruction of an object. Identify the messages that flow between the lifeline of objects. You also need to identify the properties of these messages to obtain information about the semantics of the interaction. Identify the preconditions and post conditions for each message to control the flow of objects.

Creating Communication Diagrams


Communication diagrams represent the interaction among objects in the form of messages. To draw a communication diagram, you identify the objects in collaboration and represent them as the vertices of a graph. After you place the objects, you can draw straight lines that represent the links among these objects to connect the objects. Note that objects send and receive messages across these links. The dynamic aspect of an interaction diagram can be depicted by messages that are passed among objects across links. Therefore, communication diagrams depict the organization of objects in the sequence of messages flowing between them. The constituents of a communication diagram are organized in such a way that the related objects are closely placed. The following figure shows a collaboration and the messages passed in the collaboration.

Unlike communication diagrams, sequence diagrams do not have paths that link objects and messages arranged according to time.
You can number the messages in a communication diagram for sequencing and indicating their time order. The sequence numbers are prefixed before the messages. The following figure shows the path between two objects and messages with sequence numbers in a collaboration.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

11/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

The following figure shows the objects, links, and sequence of messages among the various objects of the communication diagram for the use case, process order.

Sequence and collaboration diagrams are isomorphic. This means that they contain the same information and can be derived from each other. While sequence diagram depicts the time sequencing of messages, the communication diagram depicts structural responsibilities of the participating objects.
Sequence and communication diagrams are similar because of the fact that both represent collaboration and the messages flowing between the constituents of the collaboration. You can also depict iterations and conditions in a communication diagram in the same way as in sequence diagrams. You can derive a communication diagram from a sequence diagram by using the objects and messages of the sequence diagram. Organize the objects so that the related objects are placed together and place a sequence number before each message in the communication diagram based on the time ordering depicted in the sequence diagram. Similarly, you can derive a sequence diagram from a communication diagram by using the objects and messages of the communication diagram. Place the objects and draw their respective object lifelines. Draw the messages among objects according to the sequence specified in the communication diagrams.
www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm 12/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

The guidelines that you need to follow when you model a communication diagram are: Identify the collaboration that involves an interaction in the system, subsystem, and use cases. Identify the objects that have higher responsibility in the interaction. Draw these objects on a graph so that the objects with high responsibility are placed on one side and the objects with lower responsibility are placed on the other. Identify the links among objects. You need to place the association links to depict the relationship among objects. Identify all the messages that flow across the links established among objects.

Assigning Responsibilities to Classes


You need to assign responsibilities to a class or a set of classes to ensure that the software system has the required functions to suit the requirement document. The decisions about responsibilities of classes are taken when interaction diagrams are created. They include the decision to identify the methods that need to be invoked in one object by another object so that each instance of a class carries out its responsibilities. A responsibility is implemented by using methods of classes, which may implement the entire responsibility or collaborate with the other methods to implement a responsibility. Consider the IMS where you need to assign the responsibility of processing an order to a class or multiple classes. The supplier class has the task to submit the order. The s u b m i t O r d e r ( )method of the s u p p l i e rclass has the task to deliver the order. The o r d e rclass stores the information about the parts accepted and rejected. The order class accepts and evaluates the order received from the supplier. The IMS database stores the information about the order and the quantity of parts received and rejected. The three collaborators for processing an order are s u p p l i e rclass, o r d e rclass, and i n v e n t o r y d a t a b a s e . The following figure depicts the communication diagram with the objects carrying out their responsibilities to process an order.

The guidelines that you need to follow when you assign responsibilities to objects are:
www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm 13/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Assign responsibilities to classes such that they perform all the tasks that are performed by the real-world entity that the classes represent. Assign responsibilities to a class if the class has the attributes that will enable it to fulfill the responsibilities. Assign responsibilities to multiple classes if all the classes have the data to fulfill the responsibility. Distribute responsibilities evenly to the various classes of your software system. Check that all the classes of the software system have some responsibility assigned to them. If no responsibility is assigned to a class, you need to check whether the class is required. Check if too many or unrelated responsibilities have been assigned to a class. If such a class exists, split the class into smaller classes.

Just a minute:

Which of the following diagrams represents the interaction among objects in the form of messages? 1. Composite structure diagram 2. Communication diagram 3. Timing diagram 4. Interaction Overview diagram Answer: 2. Communication diagram

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

14/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Activity: Modeling the Dynamic View of the Bank ATM System

Problem Statement
Janes Technology has been assigned the task of creating a dynamic model of the prototype for the InfoSuper bank ATM system. Janes Technology needs to implement only the cash withdrawal system in the prototype for the InfoSuper bank. The following table describes the classes, attributes, and operations for the cash withdrawal feature of the InfoSuper bank, which the design team of Janes Technology has identified.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

15/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

16/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

The design team has also created the following class diagram after identifying the classes and operations for InfoSuper bank.

Identify the activities that the development team needs to perform to model the dynamic view of the prototype. Prerequisite : To perform this activity, you will need the BANK_ATM.vsd file, which you created in the activity Modeling the Static View of the Bank ATM System of Chapter 6.

Solution
To model the dynamic view of the cash withdrawal feature of the ATM system, you need to perform the following tasks: 1. Identify the collaboration and interactions. 2. Create a sequence diagram.
www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm 17/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

3. Create a communication diagram. Task 1: Identifying the Collaboration and Interactions The following table lists the various classes that collaborate to realize the cash withdrawal feature. Class BankCustomer Responsibilities Supply the PIN number. Select the type of transaction. Supply the amount to be withdrawn. CardScanner Accept and read the card information. Eject the card after the transaction is complete. Prompt the user for input . Verify the PIN number. Get the information about the customer's account . Verify the PIN number. Get the information about the customer's account . Verify the amount to be withdrawn. Update the amount in the account after the transaction. Transaction Starts a transaction. Get the cash balance from the account . Supply cash to the customer. Generate a receipt of the transaction.
Class Responsibilities

DisplayScreen ATMCard

Account

CashDispenser

The following figure depicts the sequence diagram for the cash withdrawal feature of the InfoSuper bank ATM system.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

18/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

The following figure depicts the communication diagram for the cash withdrawal feature of the InfoSuper bank ATM system.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

19/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Task 2: Creating a Sequence Diagram To create a sequence diagram, you need to perform the following steps: 1. Select StartAll ProgramsMicrosoft OfficeMicrosoft Office Visio for Enterprise Architects . 2. Open the Bank_ATM Visio file. The Bank ATM model appears. 3. Right-click the Iteration2 folder in the Model Explorer window, and select NewSequence Diagram. The Sequence-1 tab with a blank drawing page appears.
www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm 20/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

4. Drag the Object Lifeline symbol ( ) from the UML Sequence (Metric) stencil on the drawing page. 5. Double-click the Object Lifeline symbol to set its properties. The UML Classifer Role Properties dialog box appears. 6. Type CS in the Name text box. 7. Select Iteration2::CardScanner from the Classifier drop-down list, as shown in the following figure.

8. Click the OK button. The following figure shows the object lifeline symbol for the CardScanner class.

9. Right-click the Object Lifeline symbol and click the Shape Display Options option. The
www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm 21/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

UML Shape Display Options dialog box appears. 10. Select the Classifier name check box in General options section. 11. Click the OK button. The lifeline symbol appears as shown in the following figure.

12. Similarly, draw the object lifeline symbols for the following classes: B a n k C u s t o m e r D i s p l a y S c r e e n A T M C a r d A c c o u n t T r a n s a c t i o n C a s h D i s p e n s e r After drawing the object lifeline symbols, the sequence diagram appear should appear as shown in the following figure.

13. Increase the length of the object lifeline symbols by dragging their lower end downwards. The elongated object lifelines are shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

22/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

14. Drag the Activation symbol ( ) from the UML Sequence (Metric) stencil on the drawing page to represent the time period during which an object or actor is performing an action and place it over the object lifeline symbol for CardScanner. Adjust the length of the activation symbol as per requirement. The sequence diagram appears as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

23/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

15. Similarly, draw the activation symbols for all other classifiers. 16. Drag the Message (call) symbol ( ) on the drawing page from the UML Sequence (Metric) stencil, to represent the communication between the Bank Customer and Card Scanner classifiers, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

24/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

17. Double-click the Message (call) symbol to set its properties. A UML Message Properties dialog box appears. 18. Type AcceptCard and 1: in the Name and Sequence expression text boxes, respectively. 19. Select AcceptCard from the Operation drop-down list, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

25/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

In the UML Message Properties dialog box, Name refers to the name of the message. Operation refers to the operation to be invoked when the message reaches the target object. Sequence expression refers to the sequence number of the message.
20. Click the OK button. After setting the properties, the method is displayed, as shown in the following figure.

21. Right-click the Message (call) symbol and select the Shape Display Options option. The UML Shape Display Options dialog box appears. 22. Clear the Message arguments check box in the General options section and click the OK button. The sequence diagram appears as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

26/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

23. Similarly, represent the communication between all the objects, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

27/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Task 4: Creating a Communication Diagram To create a communication diagram, you need to perform the following steps: 1. Right-click the Iteration2 folder in the Model Explorer window, and select NewCollaboration Diagram. The Collaboration-1 tab with a blank drawing page appears. 2. Drag the Classifier Role symbol ( the drawing page. ) from the UML Collaboration (Metric) stencil on

3. Double-click Object1 to set its properties. The UML Classifier Role Properties dialog
www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm 28/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

box appears. 4. Type AC in the Name text box. 5. Select Iteration2::ATMCard from the Classifier drop-down list and 1..1 from the Multiplicity drop-down list, as shown in the following figure.

6. Click the OK button. The classifier role for the ATMCard class appears, as shown in the following figure.

7. Right-click the classifier role, AC and select the Shape Display Options option. The UML Shape Display Options dialog box appears. 8. Select the Classifier name check box in the General options section. 9. Click the OK button. The classifier role, AC appears as shown in the following figure.

10. Similarly, draw classifier roles for the following classes: B a n k C u s t o m e r


www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm 29/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

D i s p l a y S c r e e n C a r d S c a n n e r A c c o u n t T r a n s a c t i o n C a s h D i s p e n s e r After drawing classifier roles for all classes, the communication diagram should appear as shown in the following figure.

11. Drag the Association Role symbol ( ) from the UML Collaboration (Metric) stencil on the drawing page to draw the relationship between DisplayScreen and Transaction classifier roles, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

30/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

12. Double-click the association role symbol. A UML Association Role Properties dialog box appears. 13. Select Initiate Transaction from the Base Association drop-down list in the UML Association Role Properties dialog box, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

31/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Two classifier roles in a communication diagram can be connected by using an association role only if the classes corresponding to the two classifier roles are connected through an association in the corresponding class diagram.

If in the UML Association Role Properties dialog box, the Base association drop-down list is disabled, there may be two possible reasons for that: The corresponding base association does not exist in the class diagram. The direction of the association in the communication diagram needs to be reversed. For example, if End1 of the association role is connected to ClassifierRoll1 and End2 of the association role is connected to ClassifierRole 2, you may need to connect End1 to ClassifierRole 2 and End2 to ClassifierRole 1.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

32/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Base Association drop down list will have different values for different Associations depending upon the relationship created between the classes in the class diagram.
14. Click the OK button. The following figure shows the association relationship between DisplayScreen and Transaction classifier roles.

15. Double-click the association role symbol connecting the DisplayScreen and Transaction classifier roles to display the methods associated with the association role. The UML Association Role Properties dialog box appears. 16. Select Messages from Categories section in the UML Association Role Properties dialog box. The Messages section appears as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

33/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

17. Select Message1 in the Messages section and click the Properties button. The UML Message Properties dialog box appears. 18. Type SelectTransaction in the Name text box. 19. Select forward from the Direction drop-down list and StartTransaction from the Operation drop-down list. 20. Type 12: in the Sequence expression text box, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

34/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

21. Click the OK button. The UML Association Role Properties dialog box appears and displays the changed properties for the message. 22. Click the OK button. The message appears with the association role, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

35/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

23. Right-click the association role symbol connecting the DisplayScreen and Transaction classifier roles and select the Shape Display Options option. The UML Shape Display Options dialog box appears. 24. Clear the Message arguments check box in the General options section and click the OK button. The message appears as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

36/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

25. Double-click the association role symbol connecting DisplayScreen and Transaction to display other associated messages. The UML Association Role Properties dialog box appears. 26. Select Messages from Categories section in the UML Association Role Properties dialog box. The Messages section appears. 27. Click the New button. A new message is added in the Messages section as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

37/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

28. Click the Properties button. The UML Message Properties dialog box appears. 29. Type Prompt in the Name text box. 30. Select backward from the Direction drop-down list and Prompt from the Operation dropdown list. 31. Type 13: in the Sequence expression text box, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

38/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

32. Click the OK button. 33. Similarly, add the other messages between DisplayScreen and Transaction classifier roles. The following figure represents the messages associated with the DisplayScreen and Transaction classifiers.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

39/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

To represent the self association you can use Association role (

symbol insteadof Association role( ) symbol. There is no difference between the functionality of these symbols.
34. Similarly, draw the relationship between all other classifier roles and display the messages associated with them, as shown in the following figure.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

40/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

35. Save and close the Bank _ATM model. 36. Close Microsoft Visio.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

41/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Summary
In this chapter, you learned that: Dynamic modeling is used to understand the interaction among objects and the states of objects of software systems. Interaction diagrams show an interaction between the objects of a collaboration. There are four types of interaction diagrams: sequence, communication, timing, and interaction overview. Sequence diagram is a type of interaction diagrams that is used to model the flow of control by time ordering. Communication diagrams represent the interaction among objects in the form of messages.

Exercises

Exercise 1
Blue Valley Consulting Inc. decides to further enhance the functionality of the system that will enable the Operations Manager to enter details of transactions on monthly basis. This functionality will also provide a user interface that will allow the Operations Manager to add, modify, and delete cash flows. To implement this functionality, you need to incorporate two modules. The details of these modules are as follows: MODULE: RECORD TRANSACTIONS Using the Record Transactions module, the Operations Manager can enter the transaction date and amount for the lease payment for a particular property. The Record Transactions module will be invoked when either a new property is leased or a change to the property information occurs. MODULE: MAINTAIN SCHEDULE OF CASH FLOW This module will provide a user interface where the Operations Manager can enter and review the cash flows. The user interface will also allow the Operations Manager to enter cash flow repeatedly until a given date. Create the sequence and communication diagrams for the two modules. Hint: To complete this exercise, you need to use the Visio file that you created for Exercise 1 of Chapter 6.

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

42/43

7/18/12

Object-Oriented Analysis and Design Using UML: Student Guide

Reference Links

Introducing Dynamic Modeling Concepts


Reference Reading: Books The Unified Modeling Language Reference Manual by Grady Booch James RumBaugh Ivar Jacobson Publisher: Pearson Education Reference Reading: URLs http://www.smartdraw.com/resources/centers/ uml/uml4.htm#whatseq

Creating Interaction Diagrams


Reference Reading: Books The Unified Modeling Language User Guide by Grady Booch James RumBaugh Ivar Jacobson Publisher: Addison Wesley Reference Reading: URLs www.sparxsystems.com/EAUserGuide/ interactiondiagrams.htm

www.niitstudent.com/india/Content/063OUML1S1/OEBPS/13_ch07.htm

43/43

You might also like