100 likes | 276 Views
單元 3 :軟體設計 3-2 順序圖 (Sequence Diagrams). Introduction. UML(Unified Modeling Language) An standard for modeling object-oriented software. Why model software? Software is getting increasingly more complex. ( 軟體越來越複雜。 )
E N D
Introduction • UML(Unified Modeling Language)An standard for modeling object-oriented software. • Why model software? • Software is getting increasingly more complex. (軟體越來越複雜。) • Code is not easily understandable by developers who did not write it. (程式碼較不易為人所了解。) • We need simpler representations for complex systems. (較簡單的表示法。) • Tools • UML Diagrammer • Visual Paradigm for UML Community Edition • JUDE
Models • 在UML系統開發中有三個主要的模型: • 功能模型(Functional Model)從用戶的角度展示系統的功能,包括Use Case Diagram(使用案例圖)。 • 對象模型(Object Model)採用對象,屬性,操作,關聯等概念展示系統的結構和基礎,包括Class Diagram(類別圖) 、 Deployment Diagram(佈署圖) 。 • 動態模型(Dynamic Model)展現系統的內部行為。 包括Sequence Diagram(序列圖)
Software Lift Cycle Software life cycle Development cycle Requirements Engineering Design Implementation Testing Requirements Elicitation System design Analysis Object design Problem statement Use Cases(UCD) Analysis Model(CD 、 SD、DD) Maintenance
Sequence Diagram • Describe the dynamic behavior between actors and the system and between objects of the system(表示在一個使用案例中,物件之間與使用者之間執行順序的時間性的動態觀點) • Useful to find missing objects. (用以找出在之前設計所未考慮的物件。) • Complement the class diagrams (which represent structure). (和class diagram有比對和互補的功能。) • 來源 • 軟體需求規格(SRS) • 使用案例(Use Case) • 軟體系統設計書(SDD) • 活動圖(Activity Diagram)
Sequence Diagram – Symbols drliang:Teacher mail:Mail Actor(觸發者) Object(物件) 格式物件名稱:類別名稱,物件名稱可有可無 表示物件的Instance Lifeline (存在時間) 老師 2:Sendmail(title:String,…) 1: 密碼查詢 4: 已送出 3:true Message(訊息) Activation (活動時間) 訊息(方法呼叫) 回傳訊息(方法呼叫) 回傳訊息
Sequence Diagram – Example :System 學生 3: 輸入修改資料後送出 1: 點選修改資料 2: 修改學生資料表單 7:修改完成訊息 4:ValidateStdentData() 5:Update(…) 6:Sendmail(…)
Sequence Diagram – Object Type Boundary Object(邊界物件) 和使用者溝通的介面 <<boundary>> :修改學生資料明細 Entity Object(實體物件) 存放實體資料 <<entity>> :學生 Control Object(控制物件) 連接邊界物件與實體物件 <<control>> :修改學生資料控制
Sequence Diagram – Object Type • 用途 • 發現未知的物件方法 • 正確的責任分派 • 區分規則 • 演員只能跟邊界物件溝通 • 邊界物件只能跟演員和控制物件溝通 • 實體物件只能跟控制物件溝通 • 控制物件能與邊界物件、實體物件或其他控制物件溝通 • 控制物件不能和使用者溝通
<<boundary>> :主畫面 <<boundary>> :學生資料表單 <<boundary>> :確認畫面 <<control>> :修改資料控制 <<entry>> :學生 學生 11: 學生資料 4: 學生資料 12: 顯示 (資料:學生) 18: 顯示 15: 修改資料 3: 取得資料 8: 顯示卻畫面(…) 2: 顯示修改學生資料表單(…) 9: new 5: 顯示表單(資料:學生) 1: 修改資料 19:主畫面 6:修改學生資料表單 13:確認資料畫面 14:選確定後送出 7:輸入修改資料後送出 16:更新資料庫 10:驗證 17:寄信