More UML State Machine Diagram Notation - UML

Transition Actions and Guards

A transition can cause an action to fire. In a software implementation, this may represent the invocation of a method of the class of the state machine diagram.

A transition may also have a conditional guard - or boolean test. The transition only occurs if the test passes.

Figure 29.2 Transition action and guard notation

Nested States

A state allows nesting to contain substates; a substate inherits the transitions of its superstate (the enclosing state). This was a key contribution of the Harelstatechart approach that the UML is based on, as it leads to succinct state machine diagrams. Substates may be graphically shown by nesting them in a superstate box.

Figure 29.3 Nested states

For example, when a transition to the Active state occurs, creation and transition into the PlayingDialTone substate occurs. No matter what substate the object is in, if the on hook event related to the Active superstate occurs, a transition to the Idle state occurs.

Example: Ul Navigation Modeling with State Machines

Some Ul applications, especially Web Ul applications, have complex page flows. State machines are a great way to document that, for understanding, and a great way to model page flows, during creative design.

A common technique in Ul agile modeling and Ul prototyping is to model aUl with large paper sheets on walls. Each sheet represents a Web page. Post - it notes are place on the sheets to represent elements; perhaps yellow is information and pink is a control, such as a button. Each sheet is labeled, e.g., "Help Page," "Product Page," and so on.

In addition to modeling the page content with this "low tech, high touch - method, it is useful to model the flow between these pages. Therefore, on a whiteboard adjacent to the wall of Web pages, I'll sketch a UML state machine diagram. The states represent the pages and the events represent the events that cause transfer from one page to another, such as a button click. See Figure for an example of this Ulnavigation model. Of course, this small example doesn't do justice to the usefulness of the practice; it's value becomes evident for large, complex page structures.

Figure 29.4 Applying a state machine to Web page navigation modeling

Example: NextGen Use Case State Machine Diagram

There are no really interesting complex reactive objects in the case studies, so I'll illustrate a state machine diagram to show legal sequencing of use case operation. See Figure for its application to the Process Sale use case.

Figure 29.5 A sample state machine for legal sequence of use case operations


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

UML Topics