Page 80 - DCAP308_OBJECT_ORIENTED_ANALYSIS_AND_DESIGN
P. 80
Object Oriented Analysis and Design
Notes Let us discuss one more example of state diagram.
Example: Now, we consider one more example of state diagram for phone line is shown
Figure 6.20. A phone can have many states such as idle, dial tone, dialing, connecting ringing,
etc. various states and events are shown in figure below.
Figure 6.20: State Diagram for Phone Line
Source: http://www.ddegjust.ac.in/studymaterial/mca-5/mca-503.pdf
6.2.3 State Diagram Behaviour
As we have discussed above that state diagrams are used to demonstrate the behavior of an
object through many use cases of the system. Now let us show an example of state diagram
behavior.
Example: This is an example of UML behavioral state machine diagram showing Bank
Automated Teller Machine (ATM) top level state machine. ATM is initially turned off. After the
power is turned on, ATM performs start-up action and enters Self Test state. If the test fails, ATM
goes into Out of Service state; otherwise there is triggerless transition to the Idle state. In this
state ATM waits for customer interaction.
The ATM state changes from Idle to Serving Customer when the customer inserts banking or
credit card in the ATM’s card reader. On entering the Serving Customer state, the entry action
74 LOVELY PROFESSIONAL UNIVERSITY