Last updated on:May 26th, 2018,

State Transition Diagram with example in software engineering

What is State transition Diagram?

When we write our program in Object-oriented programming, then we need to make classes and objects. Objects change its states during different functions/actions performed on objects.

In state transition diagram we represent that what actions are leads to change the state of the object.

[quads id=1]

Symbols: 

state transition diagram symbols
Figure: state transition diagram symbols

Example of State Transition Diagram:

Case Study: You need to develop a web-based application in such a way that user can search other users, and after getting search complete, the user can send the friend request to other users. If the request is accepted, then both users are added to the friend list of each other. If one user does not accept the friend request. The second user can send another friend request. The user can also block each other.

Solution:

  1. First of all, identify the object that you will create during the development of classes in oop
  2. Identity the actions or events
  3. Identify the possible states for object
  4. Draw the diagram.

Object: friends 

Events or actions: Search to add a friend, add a friend, accept a friend, reject a friend, again add, block user and close.

States: Start, the friend added, friend rejected, user blocked and end.

state transition diagram in UML
Figure: state transition diagram
 
[quads id=2]
1Shares

Leave a Reply

Your email address will not be published.