next up previous contents
Next: State Activities Up: Lecture 2: Classes, Objects, Previous: State

Commentary

State diagrams capture the life cycles of objects, subsystems and systems.Transitions from one state to another in a state diagram are due to events (e.g., message received, time elapsed, errors, conditions being true). All classes whose objects change over time will have state diagrams which show such state changes. The attributes and links (to other objects) of an object determine the state of the object. There may be a special attribute to record the state of the object. Alternatively no such attribute may be present and the values of other attributes are used to determine the state of the object. Example: salesman status (true/false); invoice (paid/unpaid); car (stationary/moving), engine (running/stalled), marital status (married/unmarried). Event: something happens(car started, invoice paid, gets married). Events cause internal state changes. Initial state is starting point. End point when the object dies. Entry specifies action on entry of the state (assigning an attribute, sending a message); exit specifies action performed on the exit from a state; do specifies action performed while in the state.



Ananda Amatya
11/3/1999