撰寫使用案例(use case)以記錄專案需求,已成為軟體開發的標準作法。由於使用案例是以自然語言撰寫而成的一段文字敘述,並沒有特殊的形式要求,因此很容易入門。但是,因為自然語言有模稜兩可的特性,所以使用自然語言寫成的使用案例,也很難避免含糊且不清楚地描述。此外,由於初學者缺乏撰寫良好使用案例的經驗,因此實務上經常發現專案的真正需求無法被真實地記錄與表達,進而影響後續軟體的開發活動。 為了解決此問題,本論文應用使用案例樣式(use case pattern)所建議的正確撰寫方法,訂定一種使用案例資料模型來記錄使用案例。透過我們所訂定的格式,使用者在寫完使用案例之後,可以自我分析使用案例的內容並找出撰寫使用案例時易犯的錯誤。我們以數個實際範例說明應用此方法所能找出的使用案例撰寫問題。此外,我們開發一個Eclipse外掛程式工具,協助使用者撰寫使用案例。該工具並可依據使用案例自動產生UML中的循序圖,以視覺化的方式來分析使用案例中,使用者與系統的互動關係。
Use case has become a common practice for specifying requirements in software development. Use case is described in natural languages with little formality and is seemingly easy to write. However, writing use cases can still be challenging for two reasons. First, natural languages are often ambiguous, which makes the use cases ambiguous. Second, writing good use cases requires experiences. To solve the two problems mentioned above, we propose using a more formal format for writing use cases based on a number of published use case patterns, which capture experiences in writing good use cases. Using the proposed format, it is relatively easy for the developer to identify and correct a number of common pitfalls in writing use cases; several examples are given to show how the proposed method works. Moreover, we develop an Eclipse plug-in tool to facilitate developers in writing use cases in the formal format. This tool is also able to generate UML sequence diagram for the use case, which provides a way for visualizing how an actor interacts with the system under construction.