Table of Contents
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]
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.
- First of all, identify the object that you will create during the development of classes in oop
- Identity the actions or events
- Identify the possible states for object
- Draw the diagram.
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.