Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing UML state diagrams

When drawing state diagrams, how do you know which states get put in boxes and which states are for the transition arrows? I noticed that transitions are states too.

I'm looking at figure 1 on this page:

enter image description here

like image 383
neuromancer Avatar asked Dec 15 '09 17:12

neuromancer


People also ask

How do you draw a state diagram?

Steps to draw a state diagram –Identify the initial state and the final terminating states. Identify the possible states in which the object can exist (boundary values corresponding to different attributes guide us in identifying different states). Label the events which trigger these transitions.

What is UML state diagram?

A state diagram, sometimes known as a state machine diagram, is a type of behavioral diagram in the Unified Modeling Language (UML) that shows transitions between various objects.

What is state diagram and example?

A state diagram shows the behavior of classes in response to external stimuli. Specifically a state diagram describes the behavior of a single object in response to a series of events in a system. Sometimes it's also known as a Harel state chart or a state machine diagram.


2 Answers

Transitions are NOT states. Transitions are the events that move an object from one state to the next. States are defined by the value of variables in the object and by the behaviour of the object. Take for instance a Student object that has a value "new-waiting for approval" value. That student is not allowed to register for or attend classes. But the same student may be allowed to register for and attend classes if the value changes to "approved". What's the difference? The student object actually has two states.

What causes the Student object to move from one state to the next? The event "Approval Arrives" maybe. So Approval Arrives go on the arrow between two states.

like image 190
Vincent Ramdhanie Avatar answered Oct 04 '22 20:10

Vincent Ramdhanie


'Transition arrows' in the diagram are not states, they are "TRANSITION/ACTION/HAPPENING". For e.g. in the mentioned figure, "Scheduled" is the state, open is action after which it goes to "Open for enrollment" state. This "open" transition can be replaced more verbose with "is being opened" Unfortunately, the transition actions like scheduled/open are very easily confused for a state as well, but that is not the intent.

like image 32
Ranz Avatar answered Oct 04 '22 21:10

Ranz