Home. 
.

transparent

transparent

transparent

UML State Machine Diagrams

Altova UModel® 2012 makes it easy to identify states and transitions of an object as it proceeds through its life cycle.

UML state machine diagrams describe the behavior of a class over time through illustrations of the states and transitions of a single object progressing through its lifetime. State machine diagrams are a traditional object-oriented way to show behavior and to document how an object responds to events, including internal and external stimuli.

Whether you are planning the logic of a business object such as in invoice – whose states might be issued, paid, or overdue – or the behavior of a complex hardware-based system, you'll find UModel® 2012 to be an intuitive and enjoyable tool as you develop your state machine diagrams.

You can even acecelerate your project by generating a complete executable source code project in Java, C#, or Visual Basic from your UModel state machine diagram.



UML state machine diagram

Altova UModel Features Overview

Altova UModel® 2012 is an intuitive, affordable, and fully featured tool to create UML state machine diagrams along with the other advantages of UML-based software development. UModel supports these advanced features:

Download Click here to download a fully functional, free 30-day trial of Altova® UModel® 2012!

Drawing State Machine Diagrams

The UModel® 2012 state machine diagram toolbar brings together all the UML 2 elements you’ll need for your state machines.



UML state machine diagram toolbar

This special toolbar helps avoid confusion as you draw your diagram, since state machines share some – but not all – of the same UML element symbols used in activity diagrams.

If you’re following an iterative development process, your state machine diagrams are works in progress and you will want to revise and expand them based on new ideas and feedback from your project teammates.

UModel® 2012 makes it easy to modify existing diagrams. When you select a state to be changed, all its associated transition arrows will behave appropriately, eliminating extra steps. For instance, selecting then deleting the final state element automatically removes the transition arrow connecting it as well.



UML state machine diagram edit

Next, you may want to create a new transition from one state to another. UModel automatically connects the states with the shortest possible line.



UML state machine diagram transition

Note that the new transition arrow remains selected after you connect the states. The new transition arrow has three small icons called waypoints that can be used to alter the line characteristics and the layout toolbar alerts you of the line style that is currently selected.



UML state machine diagram layout toolbar

You can simply grab the line with your cursor and drag it to shape the path you want.



UML state machine diagram transition



UML state machine diagram transition

The new transition arrow in this example needs a guard, a Boolean statement to indicate an event or condition that will allow the transition to proceed. Without a guard, the new arrow indicates that the dehumidifier stops when the tank is full, then immediately proceeds to the sensing state. But what if humidity is still high? The circuit will turn on again and the tank will overflow.

You can easily add a guard in the UModel Properties helper window.



UML state machine diagram guard

Guard text requires brackets, which UModel provides automatically. You can select the guard in the drawing pane and move it wherever you like. You can edit the text in the Properties window or directly in the design pane if you wish.



UML state machine diagram transition

The dehumidifier example needs one more piece of logic. Consider what would happen if the room’s humidity is neither above nor below, but exactly at the critical detection level. To prevent overloading the circuits by repeatedly turning the system on/off, on/off, on/off, likely, the simplest and most cost-effective remedy would be to add a delay to the transition out of the sensing state.

UML syntax lets you add an activity that is performed during transition out of any state. Incongruous as it may sound, in this case the activity will be a short period of doing nothing.

UModel® 2012 lets you select the transition arrow, then use the right-click context menu to insert a new activity.



UML state machine diagram tranisiton activity

After you enter the text you can move it wherever you like, and the revisions to the state machine diagram in this example are complete.



UML state machine diagram

Creating Operations from Transitions

When you add a new transition to a state machine diagram that is inside a class or interface, you may assign a message name or use the operation pull-down list in the Properties helper window to assign an existing operation from the target class.

If you turn on Automatic Creation of Operations in the State Machine Diagram toolbar, you can create a new operation in the target class by typing the new operation in the transition in your communication diagram.

UML state machine diagram toolbar

Composite State Machine Diagrams

If your own project is more complex than a single dehumidifier control, you’ll find the UModel® 2012 elements for composite states, orthogonal states, and submachine states as easy to place and manipulate as simple states.

With UML joins and forks offered in a choice of orientations at a single click, and history and connection point reference elements all readily at hand, you’ll have everything you need to assemble superlative state diagrams.

Altova UModel composite state machine diagram

Click image to enlarge screenshot

Generate Code from State Machine Diagrams

UModel® 2012 lets you generate code from state machine diagrams that is fully executable, so you can quickly begin testing the logic captured in your state machine diagram. You can generate code either as part of the normal project code generation process, via a selection in the Project menu, or directly from the state machine diagram context menu.

UModel state machine context menu

The context menu also provides an option to let you check the state machine diagram syntax, to avoid generating code that is not valid. The Generate State Machine Code dialog box lets you control code generation settings, and even specify whether state machine code is automatically regenerated with project code generation.

UModel Generate State Machine Code user settings

The UModel® 2012 examples even include Visual Studio solution files for C# and Visual Basic, and a Java tester application that demonstrates execution of the state machine code and is easily adaptable to use with your own state machine diagrams.

UModel State Machine Code test application

Automatic Update of State Machine Code

Every development project goes through multiple iterations. UModel offers convenient features to manage generation of state machine code as your project progresses:

  • If there are no revisions to a state machine diagram after you generate code from your project the first time, UModel will not regenerate identical code, saving time and effort, especially when code is stored in a source control system. In this case, a message during code generation informs you that the state machine code is up to date.
  • If you want to generate intermediate code for your project, but one or more state machine diagrams are incomplete, you can uncheck the Automatic Update option in the state machine diagram properties window. This setting prevents UModel from generating state machine code prematurely and is unique for each state machine diagram, so you can focus efforts on them individually.

Altova UModel state machine diagram properties

Protocol State Machine Diagrams

Protocol state machines are a variation of state machine diagrams most often used to describe complex protocols, such as database access through a specific interface, or communication protocols such as TCP/IP. UModel supports protocol state machine diagrams as a unique diagram type with a specialized diagram toolbar. Click here to read more about support for protocol state machine diagrams. in UModel® 2012.

SysML State Diagrams

UModel also supports SysML state diagrams, which extend UML activity diagrams by adding the SysML allocate element. Click here to read more about support for SysML in UModel® 2012.


See for yourself how easy it is to create UML 2 state machine diagrams with UModel® 2012!

Download Click here to download a fully functional, free 30-day trial of Altova® UModel® 2012!



transparent
Download
Pricelist
Buy
Video
Comparison
Datasheet
Print
Mail
Like It
.
.

UML logo

.
.

Read the Altova Blog
...and get the most from our products Read the Altova Blog!

.

The techies at Altova love to show off what our applications can do! Our in-depth coverage of individual features helps you deliver exceptional projects. Subscribe here!

.
.

transparent

transparent