What is the purpose of State machine diagrams?
Objects have both attributes and behaviors. Attribute is also know as state. When objects are incredibly complicated then to have better understanding during different state changes one should develop one or more state machine diagrams, formerly called state chart diagrams in UML 1.x, describing how their instances work.
UML state machine diagrams show the various states that an object may be in and the transitions between those states. And these transitions are triggered by an event that can either be internal or external to the system.An initial state of an object is called creation state,as this is the time when an object is created, and the final state is reached when there are no more leading out transitions from this state.
A self explanatory example of state machine diagram is given here for PIN check processing at ATM.It includes sub-machine diagrams, as shown in the diagram below: