UML object-oriented analysis and modeling-[6] state chart

Source: Internet
Author: User

I. Overview

In general object-oriented technology, a state chart is also called a State migration diagram. Describes all possible states of a specific object and migration between States caused by various events. Most object-oriented technologies use state diagrams to describe the behavior of an object in its lifecycle.

Ii. Status

In all dynamic graphs (sequence, collaboration, status, and activity), messages are represented as communication between objects. Messages include simple messages, synchronous messages, and asynchronous messages. You can combine a simple message and a synchronous message into a message.

In UML, the State definition focuses on the rules of object behavior, and the State describes a time period in the lifecycle of an object. It can be described in three additional methods: A group of object values with similar properties in some aspects, an object waiting for a period of time when some events occur, and an object executing a continuous activity for a period of time. Status indicates the accumulation history of object behavior.

According to the time sequence in the status chart, the status can be divided into the initial state (initial state), intermediate state (simple state), and final state (termination state). The status can enter the internal state, it is further subdivided into several internal states (sub-states), which can be divided into combined States and sub-States. Based on the mutual exclusion of sub-states in the combined state, the combination status can be divided into the concurrent combination status and the sequential combination status.

Status type

Description

Simple status

No sub-structure status

Concurrent combination status

It is divided into two or more concurrent sub-States. When the combined state is activated, all sub-States are activated concurrently.

Sequential combination status

Contains the status of one or more unconnected sub-States, especially when the combination status is activated, the sub-state is also activated.

Initial status

The pseudo State only indicates that this is the starting point for entering the real state machine.

Termination status

Special status. entering this status indicates that all activities in the state machine status transition process have been completed.

Combined Status

Pseudo state, which can be converted once by concatenating the two into one

Historical Status

Pseudo State. Its activation saves the previously activated status in the composition status.

Sub-machine reference status

Status of the referenced sub-machine. The sub-machine is implicitly inserted into the location of the sub-machine reference status.

Pile status

Pseudo State, used to identify the State in the sub-machine reference status

A simple state is a state without sub-structures. It only contains a set of conversion and possible entry and exit actions. If several States are nested in a state, the state is called a super state or a combination state. The nested state is called a sub state. The sub-State itself can still be a combination state. The combination status can contain substatuses of sequential states or substatuses of concurrent states.

Ordered states are also called non-Intersecting states. They are migrated sequentially, not concurrently. A nested ordered state machine can have at most one initial state and one final state.

The historical state allows the combined states that contain sequential substates to remember the last active substates before the Migration triggered from the combined state. Historical states are divided into shallow and deep historical states. The history state is saved and reactivated at the same nesting level. The deep history state can remember the deeper state of the nested hierarchy in the combined state. If a nested state machine reaches a final state, the historical state will lose its storage history.

A state machine consists of the states of a series of objects. Is a graph showing the status and status transition. Is a model of all possible lifecycles of A Class Object. It reflects the state sequence of actions that an object responds to related events in its life cycle, and the responses to these events. Is a local view of an object, a graph that separates the object from its external world to test its behavior independently.

The status chart shows all possible states of a specific object and the migration between States caused by various events. The UML state chart describes the dynamic behavior of an object based on event response, and shows how the object reacts to different events based on the current state. A state chart is basically an element reaction that can be found in a state machine. That is to say, A status chart can contain branch, branch, join, action status, activity status, object, initial state, final state, and historical state.

An event is a meaningful thing that occupies a certain position in time and space. It can be synchronous or asynchronous. It can be either an external event or an internal event. An external event is an event transmitted between the system and its participants. Internal events refer to the time when objects in the system are transmitted.

Event Type

Description

Syntax

Call event

Receives explicit synchronous requests from the objects waiting for the response

Op (a: T)

Change event

Modify a Boolean expression

When (exp)

Signal event

Receives external, named, and asynchronous communication between objects.

Sname (a: T)

Time event

The arrival of absolute time or the end of a relative time

After (time)

A call event indicates a call to an operation. A change event is an event triggered when an object is in a certain state and a change or certain conditions are met. A time event refers to the time when an object enters a certain state after a certain period of time or after reaching an absolute time. A signal is a name-based object sent asynchronously by an object and received by another object. It shares many similarities with a simple class.

Migration starting from the State defines the response of objects in this state to external events.

Types of migration

Description

Syntax

Entry action

The action that is executed when a status is entered.

Entry/action

Exit action

Action executed when a status is left

Exit/action

External Migration

A migration or self-migration that changes the status, and executes a specific action at the same time, including the migration that causes the entry action and exit action to be executed.

E (a: T) [exp]/action

Internal migration

This action causes execution of an action but does not change the status or does not cause execution of the entry action or exit action.

E (a: T) [inner]/action

Complete migration means the migration of trigger events is not clear. If a status has no internal activity or nested status, the full migration will start immediately once the portal and exit activities are completed. Composite migration consists of simple migration, which are combined by branch determination, splitting, or joining.

Concurrent sub-States are used to indicate parallel execution of two or more state machines in the context of closed objects. The concurrency status chart describes the situation where an object has multiple concurrent substate machines at a certain time. The concurrency status chart is a combination of these substate diagrams. The nested concurrency state machine does not have the initial, final, or historical state, but the sequential substate that forms a concurrency State can have these characteristics. The concurrency status chart is suitable for describing the situation where an object has many independent behaviors. You can combine the status charts that express these individual behaviors to form a concurrency status chart.

A synchronization state is a pseudo State. It expresses synchronization between two concurrent sub-States together with the split and joint state to ensure that one sub-state machine leaves a certain state before another sub-state machine enters a specific State.

Iii. state chart Modeling

A status chart is suitable for describing the behavior of an object that passes through multiple use cases, but a status chart is not suitable for describing the collaborative behavior of multiple objects. To create a status chart, follow these steps:

(1) determine the context of the state machine. It can be a class, subsystem, or the whole system.

(2) establish the initial and termination statuses.

(3) determine the event that may respond to the system.

(4) from the initial state to the final state, the objects may be in the top-level state.

(5) Identify all entry or exit actions.

(6) If necessary, you can use sub-States to expand these states. Organize and simplify a complex state machine using concepts such as hyperstate, substate, branch, and historical state

(7) check whether all events involved in the state machine match the expected events in the object interface.

(8) check whether all the actions involved in the state machine are supported by operations in links, methods, and closed objects.

(9) Check the expected event sequences and their responses manually or using tools along the state machine. Find the unarrived status and false status.

(10) after reorganizing the state machine, re-check against the expected sequence to ensure that the semantics of the object is not changed.

 

 

References:

[1] Tang xuezhong, et al. UML object-oriented analysis and modeling. E-Industry Press. 2008

[2] Cai min and others. UML basics and ROSE modeling tutorial. People's post and telecommunications press. 2006

[3] by Carlo Ghezzi. Shi Ping An translation. Software Engineering BASICS (2nd) Tsinghua University Press. 2003

[4] reference website:

Http://www.omg.org/UML

Http://www.rational.com/UML

Http://www.software.ibm.com/ad/ocl

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.