UML State Diagrams(2) – Concurrent States

In the previous post i described a state diagram for a Sales Order Processing system that was based on the availability of stock items. In practice we would almost certainly requre state that were dependent on payment authorisation as well as item availablity. This leads to the notion of concurrent states, where one group of states in a diagram model the stock item availability and a separate group of states model the payment authorisation process.

The diagram below illustrates this concept of concurrent states. These concurrent states are represented in two distinct swimlanes. The concurrent sections of the state diagram a places in which, a given order can be in two different states. When an order leaves a concurrent state it will be i a single state only.

The concurrent state diagrams are useful where a given object has multiple sets of independent behaviours. In practice, I prefer to limit the number of concurrent states to a small number, usually two or three, and when I have more than three I would normally split out the independent behaviours into separate objects as I find that this improves diagram clarity and readability, as well as improving the integrity of subsequent code.

State diagrams are useful for describing the behaviour of objects that often span more than one Use case. For models that describe the interaction of several objects I prefer to use the UML Interaction Diagram.

ga_algorithm_statechart

In the next blog post I will describe the UML Interaction Diagram, and provide some examples of its use to describe the interplay of messaging and events between  co-operating groups of objects.

James Goode, Tendron Systems Ltd

Advertisements

UML State Diagram ( Part-1 )

UML State Diagrams

State diagrams are one of the most valuable techniques available for describing the real-time behaviour of a software system. A well constructed state diagram denotes all the states that a specific object or class can be in. In addition a state diagram describes when and how transitions between the states occur as a result of external events that affect the object. Usually a state diagram is written for each class that exhibits real time behaviour.

The UML state diagram has its origins in earlier research work on real time systems and represents the distilled expertise of three decades of research by numerous experts, David Harel, Ed Yourdon, Grady Booch, James Rumbaugh among others.

UML State Diagram

UML State Diagram

Continue reading