- e.g. When you throw a switch, a light changes its state from off to on
- e.g. The update_mark method changes the state of the student subject object
A state diagram shows the various states of a single object
- There must be a separate transition diagram for each object class
- It helps analysts, designers and developer understand the behavior of the objects in the system,
- State diagrams ensure that they won't have to guess about what the object is supposed to do
When do we care about States?
- A class has a complex life cycle
- Properties of the class may be updated at multiple points in the life cycle
- When one class is dependent on the existence or behavior of other classes
- When the behavior of a class depends on what previously happened
We can definitely say that state transition diagram show class state and the events that cause them to transition between states.
- An event happens at a specific time and place
- Events cause a change of state for the object as the transition "fires"
Each time on object changes state, some of its attributes must change
Fair but thnxxx for the knowledge.
ReplyDeleteya sv m thnx
ReplyDelete