收藏 分享(赏)

软件工程英文教程(6).ppt

上传人:gnk289057 文档编号:8084189 上传时间:2019-06-08 格式:PPT 页数:24 大小:672KB
下载 相关 举报
软件工程英文教程(6).ppt_第1页
第1页 / 共24页
软件工程英文教程(6).ppt_第2页
第2页 / 共24页
软件工程英文教程(6).ppt_第3页
第3页 / 共24页
软件工程英文教程(6).ppt_第4页
第4页 / 共24页
软件工程英文教程(6).ppt_第5页
第5页 / 共24页
点击查看更多>>
资源描述

1、Modelling Dynamics of Objects - Building State Transition Diagrams,Dr Lily Sun 2011/2012,Learning Objectives,To appreciate the role of modelling dynamics of an object in relation to the systems designTo establish views on stable states of an object in its lifetime during which the states change driv

2、en by the eventsTo model such states change in State Transition DiagramsTo apply the principles and style guide of Sate Transition Diagrams while design and document the state change which in turn will guide the construction of coding,Modelling Dynamic Behaviour,Activity Diagrams high-level activiti

3、es accomplished by human agents and/or machine agents in a given business domainInteraction Diagrams (e.g. Sequence Diagrams) technical functions performed by software systems these technical functions are realised by the interaction (message passing) between the involving objects in logical sequenc

4、es State Transition Diagrams An effect to an object caused by actions triggered by events to satisfy certain conditions,Modelling the Behaviour of an Object,Software systems are event-driven continuously wait for the occurrence of some external or internal event, such as a mouse click a button press

5、 a time tick an arrival of a data packet post to a manipulation on objects, a resultant value (i.e. effect) reflects a status of the object at the present momentStates of an object an object may hold a number of states which represents the corresponding situation of the object a state can be caused

6、by one event or the different events under certain conditions,State Transition Diagrams,Behavioural state machine to specify the serious states that an object goes through during its lifetime in response to events different events trigger the object to hold corresponding states (i.e. results of mani

7、pulations)To model states of an object and its reactions to messages or other events during its lifetimeTo establish boundaries of the existence of an object (start and finish state)To analyse events, actions, and guard conditions associated with the transition between the states of the object,Conce

8、pts for State Transition Diagrams,State a condition or a situation during the life of an object during its life, the object satisfies some condition, performs some action or waits for some event (message)Initial State represent the point at which an object begins to existFinal State represent the po

9、int from which an object begins to cease all the actions,aState,Concepts for State Transition Diagrams (cont.),Event is an occurrence that is relevant to the object and triggers actions in the objectexternal event - known as a system event, caused by something (e.g., actor) outside the system bounda

10、ryinternal event - caused by something inside the system boundary when an operation is invoked via message that was sent from another internal objecttemporal event - caused by the occurrence of a specific date and time or passage of time,anEvent,Concepts for State Transition Diagrams (cont.),Action

11、is an executable atomic computation operation calls the construction or destruction of another object, or the sending of a signal to an objectTypes of Action entry effect executed upon entry to a state, no matter which transition led you in exit effect executed upon exit from a state, no matter whic

12、h transition led you away do-activity effect is an ongoing activity carried out by the object this activity will continue till it is interrupted by an event,anAction(),Concepts for State Transition Diagrams (cont.),Transition is a relationship between two states indicating that an object in the firs

13、t state will perform certain actions and enter the second state when a special event occurs and specific conditions are satisfied source state initiate an transition which trigger an event target state the state that is active after the completion of the transition event trigger the event whose reco

14、gnition by the object in the source state makes the transition eligible to fire, providing its guard condition is satisfied guard condition a Boolean expression: true the transition is eligible to fire; false do not fire,anEvent,Concepts for State Transition Diagrams (cont.),Frame the context (scope

15、) within which the state behaviour is modelledIs normally focused on ONE object,context,Guidelines for Creation of State Transition Diagrams,Set a context (i.e. select one object)Identify the initial, final, and stable states of the object within the contextDetermine the order in which the object wi

16、ll pass through the stable statesIdentify the events, actions, and guard conditions associated with the transitionsValidate the state behaviour referring to the class model and the use case model,Illustration of a State Transition Diagram,Order,Concurrent States in their Transitions,Articulating Con

17、cerning Objects,Order,OrderItem,Item,Customer,1 1*,0* 1*,0*1*,places,describes,order_id: string orderDate: date customer_id: string orderStatus: string, updateStatus(e:=event),oI_id: string item_id: string quantity: int price: currency,item_id: string itemName: string description: string unitPrice:

18、currency,Analysis of Events and States for Objects,Orderpersistent,orderStatus: string,updateStatus(e:=event),Monitoring this state change,executing the actions to change the previous state in to a resultant state,Stage 1 Select a class Identify an interest of state change,Orderpersistent,add() remo

19、ve() update() find() updateStatus(e:=event),order_id: string orderDate: date customer_id: string orderStatus: string,Analysis of Events and States for Objects (cont.),Stage 2 Identify the possible events,Orderpersistent,orderStatus: string,updateStatus(e:=event),trigger(event),change the previous st

20、ate,process the current event,Analysis of Events and States for Objects (cont.),Stage 3 Identify the stable states as the results of the event occurrences,Orderpersistent,orderStatus: string,updateStatus(e:=event),trigger(by event),change the previous state,process the current event,A list of stable

21、 states,receivedapprovedpendingconsolidateddeliveredinvoicedpaidcancelled,The State Transition Diagram Example 1 the flat state machine,paid,received,invoiced,consolidated,approved,the order been created by the customers request,the order been sent for approval,proceed the order,the customer been re

22、quested for further information,Order,pending,the customer proved further information,cancelled,the customer withdrawn,the order terminated,delivered,the invoice been created,the order been consolidated,the order been dispatched,the customer paid,the payment confirmed,the customer received the order

23、,the order closed,Pseudo Codes for State Transitions,typedef order s_start, s_received, s_approved, s_pending, s_consolidated, s_delivered, s_invoiced, s_cancelled, s_paid_AND_delivered, s_closed STATES;/*/ updateStatus(e): event; case e:= “order created”orderStatus:= “received” end case;case e:= “s

24、ent for approval”if it is approvedthen orderStatus:= “approved”if the customer is required to provide further informationthen orderStatus:= “pending” end case;,Pseudo Codes for State Transitions,case e:= “proceed order”do createInvoice(); message to Payment objectdo createConsolidation(); message to

25、 Shipping objectif the invoice is create AND the order is consolidatedthen orderStatus:= “invoiced” AND “consolidated” end case;case e:= “customer withdrawn”orderStatus:= “cancelled”if the order has not been proceededthen the order terminatedelsesend messages to the relevant objects for modification

26、s end case;,Pseudo Codes for State Transitions (cont.),case e:= “the customer paid”orderStatus:= “paid” AND self end case;case e:= “the order is delivered”orderStatus:= self AND “delivered” end case;if orderStatus:= “paid” AND “delivered”then orderStatus:= “cloesed”elseif orderStatus:= “paid” AND se

27、lfthen do trackPayment();ANDIf orderStatus:= self AND “delivered”then do trackDelivery(); ,composite states,Design the Pseudo Codes,The State Transition Diagram Example 2 the flat state machine,Input the object with resultant value,Assist the logic of transition for states changes,Tracking a Objects

28、 Statutes - Design of a state change model,Input events,Practical on State Transition Diagramming,What is the purpose of state transition diagramming?How can a class diagram assist a state transition diagramming?What are the features of state transition diagrams?Create state transition model(s)What can you improve your design of the model?,

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报