14.6 ACTIVITY DIAGRAM


14.6 ACTIVITY DIAGRAM

An activity diagram tells us how a desired end result can be achieved by a group of activities working together. An important issue in the construction of an activity diagram is the identification of those sub-activities that can be executed simultaneously, through either multiprocessing or multithreading, and those that must be executed serially. Toward that end, an activity diagram gives us a representational tool called the synchronization bar. In Figure 14.20, a synchronization bar is shown by a double line with activities flowing into it and flowing out of it. (Official UML notation for this bar is a thick solid line) The figure shows a synchronization bar with multiple incoming and outgoing activities and with a condition [condition] attached. The meaning of the synchronization bar with respect to the incoming and the outgoing activities is different. All multiple incoming activities must be executed successfully before control is allowed to proceed beyond the synchronization bar. The successful completion of all the incoming activities is subject to the condition attached to the bar. In that sense, a synchronization bar is conjunctive with respect to the incoming activities. With regard to the outgoing activities, a synchronization bar tells us that the activities are allowed to be executed in parallel and independently of one another.

click to expand
Figure 14.20

As shown in Figure 14.20, activities are represented by ovals in an activity diagram. The arrows coming into an activity and emanating outwards from an activity are referred to as triggers. If an activity has a single incoming trigger, the activity is enabled upon the receipt of that trigger, which in most cases would be the successful completion of the previous activity that is the source of that trigger. In Figure 14.21, successful completion of Activity 1 would send a trigger out along the path shown that would then enable Activity2.


Figure 14.21

An activity is disjunctive with respect to multiple incoming triggers. What that means that if a trigger is received from any one of the incoming paths, the target activity would be enabled. In Figure 14.22, SpecialActivity would be enabled provided at least one of Activity1, Activity2, , ActivityN is completed successfully. An activity diagram makes a special provision for representing a purely decision activity, which in most cases will consist of testing the value of a boolean variable. This type of activity is represented by a diamond, as shown in Figure 14.23.

click to expand
Figure 14.22

click to expand
Figure 14.23

The rest of this section shows an activity diagram for the internet auction example. This diagram represents the flow of activities for the process with the following textual description:

When a Buyer checks in, we must ascertain whether or not he/she is an already registered user of the system. If not, we ask the Buyer to fill out a form and supply the information needed. The Buyer proceeds to Browse through the list of items that he/she is interested in. The Buyer is given the option of either bidding on the items individually, or bidding on groups of items together (what if the Buyer wants two works of art together or none, or four Louis IV chairs together or none). When the Buyer begins to start selecting items to bid on, we want to start the process of running a credit check on the Buyer. If the bids placed by the Buyer and the credit check are okay, we want to proceed to payment authorization before instructing the seller(s) to ship the item(s) to the Buyer.

The activity diagram that is shown in Figure 14.24 identifies those activities that can be carried out concurrently. The concurrently implementable activities emanate from the two synchronization bars labeled "fork" in the figure. The synchronization bar labeled "merge" is used to denote the condition that the multiple activities incident on the bar must simultaneously conclude successfully before the flow of control can proceed forward. Note in particular the activity segment from P to Q. The condition label associated with the synchronization bar at P is

    *[for each item in group] 

click to expand
Figure 14.24

The symbol ‘*' here means multiple triggers, in the sense that it designates that the displayed thread of activity from P to Q actually consists of a parallel bundle of threads, each consisting of the activity shown. Therefore, the number of concurrent paths emanating from the synchronization bar at P equals the number of items in the group of items the Buyer is interested in.




Programming With Objects[c] A Comparative Presentation of Object-Oriented Programming With C++ and Java
Programming with Objects: A Comparative Presentation of Object Oriented Programming with C++ and Java
ISBN: 0471268526
EAN: 2147483647
Year: 2005
Pages: 273
Authors: Avinash Kak

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net