Use Case Diagram:Include and Extend

  • 22324
  • 0
  • 2010-12-13

摘要:Use Case Diagram:Include and Extend

緣起

初學Use Case Diagram,對於Include and Extend的關係常會混淆

究竟Include and Extend間的差別與定義是什麼呢? 讓我們看下去

 

定義與說明

首先來看看OMG的定義

  • Include : An include relationship defines that a use case contains the behavior defined in another use case.
  • Extend : A relationship from an extending use case to an extended use case that specifies how and when the behavior defined in the extending use case can be inserted into the behavior defined in the extended use case.

延伸說明:以上圖當例子

  • Include : UC登入 include UC驗證帳號密碼,代表登入流程中必然包含驗證帳號密碼的流程,不可或缺
  • Extend : UC查詢密碼 extend UC登入,代表登入流程中查詢密碼流程是可有可無的,也就是可選的,像是使用者帳密錯誤時,可選擇查詢密碼但也可能放棄查詢而重新輸入帳號密碼

 

結論

  • Include and Extend間的差異,主要為Include關係中的UC流程是一定會被執行的,而Extend關係中Extending UC的流程則是可選的,有條件性的被執行
  • 若兩個UC有共同的流程,則可將共同的部分提出來成為一個共用UC,再以Include關係使用之,故此,被include的UC通常會被其他的UC所Include
  • Extend關係中,特別要注意箭頭的方向,UC查詢密碼 指向 UC登入,代表UC查詢密碼擴充UC登入,代表UC查詢密碼是有條件性發生的
  • Include關係中,兩個UC間是缺一不可的;Extend關係中,兩個UC是可以各別存在的

 

相關參考

寫得很淺薄,詳細可參考下列資訊

WIKI

UML Superstructure Specification, v2.0
 

分享