Must know something of everything and everything of something!

State Diagrams

上一篇 / 下一篇  2007-03-30 15:28:51 / 个人分类:Testing

State Diagrams51Testing软件测试网 ^6C:MNw0{7\7I

51Testing软件测试网J3? R9F f,[

State diagrams are used to describe the behavīor of a system.  State diagrams describe all of the possible states of an object as events occur.  Each diagram usually represents objects of a single class and track the different states of its objects through the system. 

(wl?|#} T0

When to Use: State Diagrams

51Testing软件测试网&]r/~*S"m*f

Use state diagrams to demonstrate the behavīor of an object through many use cases of the system.  Only use state diagrams for classes where it is necessary to understand the behavīor 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 asinteraction diagramsandactivity diagrams.151Testing软件测试网 B S8F^C~;Px-v

How to Draw: State Diagrams

51Testing软件测试网0Dmf,~I:buqN

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.   51Testing软件测试网^P8A s @

51Testing软件测试网-zs}T E%Kv

51Testing软件测试网YB*~9B Y BG

#\(a f4\L'q(|d0All state diagrams being with an initial state of the object.  This is the state of the object when it is created.  After the initial state the object begins changing states.  Conditions based on the activities can determine what the next state the object transitions to.51Testing软件测试网N){@7u6E0ua_/a

)`A*j7HX/LB1\F051Testing软件测试网 _u]0^O)d

51Testing软件测试网G{)Qg+K)h&u

Below is an example of a state diagram might look like 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.

r&Y)hnQ%d1v;sC1s0
51Testing软件测试网D0G-j2~ kv~X8M

E)n2f;q JA*T0
51Testing软件测试网 e7p+t9^5F/`"~n+i

State diagrams can also show a super-state for the object. A super-state is used when many transitions lead to the a certain state.  Instead of showing all of the transitions from each state to the redundant state a super-state can be used to show that all of the states inside of the super-state can transition to the redundant state.  This helps make the state diagram easier to read.

~)Fd a pp @0?p.o0

v-jN4Jtl'Uf8n0The diagram below shows a super-state.  Both the Checking and Dispatching states can transition into the Canceled state, so a transition is shown  from a super-state named Active to the state Cancel.  By contrast, the state Dispatching can only transition to the Delivered state, so we show an arrow only from the Dispatching state to the Delivered state.  51Testing软件测试网qp1lJ` E

(pdp1gis0

'[?!rs;z}0

相关阅读:

TAG: UML

 

评分:0

我来说两句

日历

« 2024-04-14  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 76705
  • 日志数: 93
  • 建立时间: 2007-03-22
  • 更新时间: 2007-12-31

RSS订阅

Open Toolbar