【正文】
上,特別是在分析階段 ?如果它能夠帶來顯著的好處 (特別是在設計中) , 我們可以添加 上海交通大學計算機科學與工程系 2020/11/4 83 POS領域模型中的組合 S a l e s L i n e I t e mS a l e1 . .*P r o d u c tS p e c i f i c a t i o nP r o d u c tC a t a l o g 1 . .*11上海交通大學計算機科學與工程系 2020/11/4 84 時間間隔和產(chǎn)品價格 ?迭代 1 中的錯誤 ? SalesLineItems 與 ProductSpecifications 關(guān)聯(lián),記錄了銷售項的價格 ? 當價格改變時,以前的銷售將指向新的價格,這是不正確的 上海交通大學計算機科學與工程系 2020/11/4 85 Sale date time Sales LineItem quantity Product Specification description itemID 1.. * Describedby * 1 Product Catalog ... Product Price activeInterval : TimeInterval price : Money TimeInterval start : timeStamp end : timeStamp 1.. * 1 1 Pricedby 4 1.. * * 上海交通大學計算機科學與工程系 2020/11/4 86 關(guān)聯(lián)角色名稱 ?關(guān)聯(lián)的每一端都是一個角色,角色有各種屬性 ? 名字 ? 多重性 Flight City Fliesto * destination role name describes the role of a city in the Fliesto association Person * parent Creates 4 2 child 1 上海交通大學計算機科學與工程系 2020/11/4 87 導出元素 ?導出元素可以由其它元素所確定 ?要避免在圖中顯示導出元素,因為這些導出元素在沒有增加新信息的情況下還會增加復雜性。它表明當某事件發(fā)生時,對象從先前的狀態(tài)轉(zhuǎn)換到后來的狀態(tài) ? Event “off hook”, “idle” to “active” state transition 上海交通大學計算機科學與工程系 2020/11/4 25 狀態(tài)圖 off hook Idle Active on hook Telephone state transition event initial state 上海交通大學計算機科學與工程系 2020/11/4 26 狀態(tài)圖的對象 ? Classes (conceptual or software) ? Use cases 上海交通大學計算機科學與工程系 2020/11/4 27 Use Case 狀態(tài)圖 ?表示用例的外部系統(tǒng)事件的合法順序 WatingForSale EnteringItems enterItem WaitingForPayment makeNewSale makePayment endSale (external) system event Process Sale (a simple version) 上海交通大學計算機科學與工程系 2020/11/4 28 用例狀態(tài)圖的用途 ?系統(tǒng)實現(xiàn)必須保證正確的系統(tǒng)事件順序 ? Hardcoded conditional tests for outoforder events ? Use of the State pattern ? Disabling widgets in active windows to disallow illegal events ? A state machine interpreter that runs a state table representing a use case statechart diagram 上海交通大學計算機科學與工程系 2020/11/4 29 Wa t i n g F o r S a l e E n t e r i n g I t e m se n t e r I t e mWa i t i n g F o r P a y m e n tm a k e N e w S a l em a k e C a s h P a y m e n te n d S a l eA u t h o r i z i n g P a y m e n t m a k e C h e c k P a y m e n tm a k e C r e d i t P a y m e n ta u t h o r i z e dP r o c es s S al e上海交通大學計算機科學與工程系 2020/11/4 30 類 ?與狀態(tài)相關(guān)的對象 ? Use cases ? Stateful sessions ? Systems ? … ?狀態(tài)無關(guān)的對象 ?為具有復雜行為的狀態(tài)相關(guān)的對象建立狀態(tài)圖 上海交通大學計算機科學與工程系 2020/11/4 31 顯示事件 ?事件類型 ? External event ? Internal event ?Generally in the form of Method invocation ? Temporal event ?優(yōu)先選擇狀態(tài)圖來顯示外部和時間事件,以及對它們的響應,而不是采用它們對基于內(nèi)部事件的對象行為進行設計 上海交通大學計算機科學與工程系 2020/11/4 32 Transition Actions and Guards I d l eo n h o o kA c t i v et r a n s i t i o n a c t i o ng u a r d c o n d i t i o n[ v a l i d s u b s c r i b e r ]o f f h o o k / p l a y d i a l t o n e上海交通大學計算機科學與工程系 2020/11/4 33 Nested States I d l eo f f h ook / pla y dia l t oneo n hookA c t i v e[ v a l i d s u b s c r i b e r ]P l a y i n g Di a l T o n eDi a l i n g Co n n e c t i n gd i g i td i g i tc o mp l e t eT a l k i n gc o n n e c t e d上海交通大學計算機科學與工程系 4. 用例間的關(guān)聯(lián) 上海交通大學計算機科學與工程系 2020/11/4 35 引言 ?用例之間可以彼此相關(guān) ? Include ? Extend ?但是,不要在分析用例圖和用例關(guān)系上花太多時間,需求分析的主要工作是寫文本 上海交通大學計算機科學與工程系 2020/11/4 36 包含關(guān)系 ?多個用例具有部分共同的行為非常常見 UC1: Process Sale … Main Success Scenario: arrives at a POS checkout with goods and/or services to purchase … pays and System handles payment … Extensions: 7b. Paying by credit: Include Handle Credit Payment by check: Include Handle Check Payment UC7: Process Rental … Extensions: 6b. Paying by credit: Include Handle Credit Payment UC12: Handle Credit Payment … Level:Subfunction Main Success Scenario: 1. Customer enters their credit account information 2. System sends payment authorization request to an external Payment Authorization Service System, and requests payment approval 3. System receives payment approval and signals approval to Cashier 4.. Extensions: 上海交通大學計算機科學與工程系 2020/11/4 37 ? In the ATM system, the use cases Withdraw Cash, Deposit Cash, and Transfer Funds all include the use case Identify Customer. 上海交通大學計算機科學與工程系 2020/11/4 38