Presentation is loading. Please wait.

Presentation is loading. Please wait.

Nested state diagrams:Problems with flat state diagram

Similar presentations

Presentation on theme: "Nested state diagrams:Problems with flat state diagram"— Presentation transcript:

1 Nested state diagrams:Problems with flat state diagram
Impractical for large problems. Problem is true for flat state diagram. Object with n independent attributes require 2n states for representation of object in single flat state diagram. complex system contain much redundancy that structuring mechanism can simplify.

2 Expanding states Organize model by having a high level diagram with subdiagrams expanding certain states. (Like macro substitution) A submachine is a state diagram that may be invoked as part of another state diagram. UML notation is to list local state name followed by a colon and submachine name. Submachine is a state diagram “subroutine”.

3 Nested states States can be structured more deeply than just replacing a state with submachine. For that you can nest states to show their commonality and share behavior. Composite state name labels the outer contour that entirely encloses the nested states. You can nest states to an arbitrary depth. Each of the nested states receives the outgoing transitions of its composite state.

4 Nested states It is possible to represent more complicated situations like an explicit transition from nested state to a state outside the contour or an explicit transition into the contour. In simpler case where there is no interaction except for initiation and termination , you can draw the nested states as separate diagrams and reference them by including the submachine.

5 Nested states For simple problems, you can degrade nested states into flat state diagram. Another option is to promote each state to a class. Entry and exit activities are useful in nested state diagrams. Because they permit a state to be expressed in terms of matched entry-exit activities without regards of what happens before or after the state is active. Transition into or out of nested state can cause execution of several entry or exit activities.

6 Signal generalization
You can organize signals into a generalization with inheritance of signal attributes. You can view every actual signal as a leaf on a generalization tree of signals. In a state diagram, a received signal triggers transitions that are defined for any ancestor signal type. A signal hierarchy permits different levels of abstraction to be used in a model.

7 Concurrency State model implicitly supports concurrency among objects.
Objects a re autonomous entities that can act and change state independent of one another. Objects need not be completely independent, share some constraints.

8 Aggregation concurrency
Aggregate state corresponds to the combined states of all the parts. It is the “and- relationship”. The aggregate state is one state from fist diagram and a state from second diagram and a state from each other diagram. The part states interact. Transitions for one object can depend on another object being in a given state. This allows interaction between state diagrams.

9 Concurrency within an object
It is possible to partition some objects into subsets of attributes or links, each of which has its own subdiagram. The state of object comprise s one state from each subdiagram. The subdiagram need not be independent. Concurrency within object is shown by partitioning the composite states into regions with dotted line. Place the name of composite state in a separate tab so that it does not become confused with concurrent region.

10 Synchronization of concurrent activities
Sometimes one object must perform two or more activities concurrently. The object does not synchronize the internal steps of the activities but must complete both activities before it can progress to its next state. E.g. cash dispenser The number of concurrently active states varies during execution from one to two and back to one again.

11 Synchronization of concurrent activities
The concurrent activities in a composite activity are shown by partitioning a state into regions with dotted lines. Each region is a subdiagram that represents a concurrent activity within the composite activity. The composite activity consists of exactly one state from each subdiagram.

12 Synchronization of concurrent activities
A transition that forks indicates splitting of control into concurrent parts. A small heavy bar with one input arrow and two or more output arrows denotes the fork. The event and an optional guard condition label the input arrow. The output arrows have no labels. Each output arrow selects a state from different concurrent subdiagram.

Download ppt "Nested state diagrams:Problems with flat state diagram"

Similar presentations

Ads by Google