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]


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.


  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]
Fazal Rehman Shamil
Welcome to all friends. The reason for our success is only your love for T4Tutorials. Our team is always available to answer your queries regarding any kind of confusions or discussion regarding your study and career matters. For discussion with us please join our facebook group "". The link of the group is mentioned below. Thanks and love to all for connecting with us. We are nothing without you. Love you all.....

Leave a Reply