Presentation is loading. Please wait.

Presentation is loading. Please wait.

BM by States class / System

Similar presentations


Presentation on theme: "BM by States class / System"— Presentation transcript:

1 BM by States class / System
In the context of behavioral modeling, two different characterizations of states must be considered: the state of each class as the system performs its function and the state of the system as observed from the outside as the system performs its function The state of a class takes on both passive and active characteristics . A passive state is simply the current status of all of an object’s attributes. The active state of an object indicates the current status of the object as it undergoes a continuing transformation or processing.

2 State Diagrams State diagrams are used to describe the behavior of a system. State diagrams describe all of the possible states of an object as events occur. 

3 BM by States Concepts state—a set of observable circum-stances that characterizes the behavior of a class/system at a given time state transition—the movement from one state to another event—an occurrence that causes the class/system to exhibit some predictable form of behavior action—process that occurs as a consequence of making a transition

4 BM by States a method make a list of the different states of a class/system (How does the class/ system behave?) indicate how the class/system makes a transition from one state to another (How does the class/system change state?) indicate event indicate action draw a state diagram or a sequence diagram

5 When to Use State Diagrams
Use state diagrams to demonstrate the behavior of an object through many use cases of the system.  Only use state diagrams for classes where it is necessary to understand the behavior of the object through the entire system.  Not all classes will require a state diagram and state diagrams are not useful for describing the collaboration of all objects in a use case.  State diagrams are other combined with other diagrams such as interaction diagrams and activity diagrams

6 How to Draw State Diagrams
State diagrams have very few elements.  The basic elements are rounded boxes representing the state of the object and arrows indicting the transition to the next state. The activity section of the state symbol depicts what activities the object will be doing while it is in that state.   

7

8 Examples: State Diagram for the Stack Class
Push[N=Size]/N=N+1+1 Push[N<Size]/N=N+1+1 Pop[N > 0]/N=N-1 Push/N=N+1 Pop/ N=N-1 Pop[N = 0]/N=N-1 Empty Entry: N = 0 Not Empty Full

9 State Diagram for the System Inverse
Push [N<Size]/N=N+1+1 Pop [N > 0]/N=N-1 Push/N=N+1 Enquing Printing Pushing Preparing N = 0 Push [N=Size]/N=N+1+1 Pop [N = 0]/N=N-1

10 Example of a state diagram for an Order object
When the object enters the Checking state it performs the activity "check items."  After the activity is completed the object transitions to the next state based on the conditions [all items available] or [an item is not available].  If an item is not available the order is canceled.  If all items are available then the order is dispatched.  When the object transitions to the Dispatching state the activity "initiate delivery" is performed.  After this activity is complete the object transitions again to the Delivered state.

11 Example of a state diagram for an Order object

12 Example: ordinary two-position light switch
Practice: Draw a state diagram for the following behaviour A light switch will have two states: up and down. (We could call them "on" and "off" if we liked.) A light switch only has one possible event: the switch gets flipped. We could call this two different events (gets flipped up, gets flipped down)

13


Download ppt "BM by States class / System"

Similar presentations


Ads by Google