State Diagram in Software Engineering | State Machine Diagram
State Diagram is one of the UML Diagram which use to show the dynamic behavior of the system.
We use the state diagram only when any object of the system changes its states in the life. This diagram helps us in representing how an object goes through from one state to other and what are the factors which make the object to transit from one state to other, When object move from one state to other if we have options to go in different states so what state an object chose to move forward and where the chosen state take the object.
there is no Rocket science involve in the state diagram, you being an object of the person class have a unique name lets say "John" and you in your whole life make keep transiting through different states up different factors.
The factor of feeling sleepy transit you to the sleeping state, the factor of being hungry transit you to the eating state, the factor or the environment which you hate transit you to the Angry state.
This UML Diagram only represent your transitions from one state to another in a flow.
Being a human if you start to make your life state diagram I don't think you can predict all the states through which you will pass in future. Because it depends on the environmental factors and lots of other external factors but the GOD knows your state diagram very well isn't it?
same like this when you develop a software, It could be the bundle of classes, and there would be lots of objects of different classes, Now the object of the class do not know the states from which or to which it will transit in the whole life, But the creator of the object in this case that's you being a programmer or Software Engineer knows very well the states from which an object going to pass in different situation so according to your knowledge you make this state diagram.
Now The objects in the software are not like Humans they some times change the states but most often they are assign to a task (specific task) and by remaining in a single state the keep performing those tasks and dies at the end just after completing the assigned task this is the case in most of the objects in software you don't have to draw state diagram for these kind of software just think if the software is not changing the state in the whole life what is the purpose of making state diagram.
If there are some objects who are assigned to some task but change the state on factors then you have to make a state diagram for it.
I have given the examples of objects changing the states, may be the example of Easypaisa in the video will be beneficial to understand what I have describe in the whole article till now.
I will recommend you to watch the video now it will help you to clear the concepts.