01.01.2015 Views

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

210<br />

Saturday Evening<br />

Defining Internal Events and Activities<br />

The state icon can also be expanded. The purpose of the expanded form is to reveal what<br />

the object can do while it is in a given state. The notation simply splits the state icon into<br />

two compartments: the name compartment and the internal transitions compartment, as<br />

illustrated in Figure 20-12.<br />

State name compartment<br />

Internal transitions compartment<br />

Figure 20-12 The expanded state icon<br />

The internal transitions compartment contains information about actions and activities<br />

specific to that state. You’ve seen actions associated with events. Here I’m talking about the<br />

same actions, only documented as entry and exit actions within a state. But I’m going to<br />

hold off until Session 21 to explain entry and exit actions so that I have room to explain<br />

them with some illustrations. For now I want to focus on activities.<br />

Activities are processes performed within a state. An activity tends not to be atomic, that<br />

is, an activity may be a group of tasks. Activities may be interrupted because they do not<br />

affect the state of the object. Contrast this with the earlier definition of an action, which<br />

said that you must not interrupt actions because they alter the state. Stopping an action<br />

midway could leave the object in an undefined state. Activities just do work. They do not<br />

change the state of the object.<br />

For example, Figure 20-13 models the active state of the Customer object. While in that<br />

state, the customer object generates a monthly invoice for the customer’s purchasing activity<br />

and generates monthly promotions tailored to the Customer. <strong>To</strong> model activities within a<br />

state, use the keyword Do: followed by one or more activities.<br />

Active<br />

Do : generate monthly invoice<br />

Do : generate monthly customer promotion<br />

Figure 20-13 The expanded state icon with activities<br />

These activities will be performed from the time the object enters the state until the<br />

object leaves the state or the activity finishes.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!