【文章內(nèi)容簡(jiǎn)介】
customer to reenter credit card information and retry Alternative: 會(huì)員 3a. System displays current shipping information, pricing information, and last four digits of credit card information 3b. Customer may accept or override these defaults Return to primary scenario at step 6 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 34 ?思考 … ? 用例是相關(guān)的成功或者失敗的場(chǎng)景的集合 ?“在 ATM機(jī)中輸入用戶 ID ?不能建模為單獨(dú)的 Use Case,因?yàn)闊o(wú)人使用系統(tǒng)僅僅為了輸入 ID 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 35 ?用例是什么,不是什么 ? 用例是需求,而且主要是功能需求,反映了系統(tǒng)將做什么 ? 用例是需求,而不是功能或者特征列表 ? 用例是文檔,而不是圖,用例建模主要是寫(xiě)文字,而不是畫(huà)圖 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 36 編寫(xiě)用例 ?不同形式化程度 ? 摘要 ? 非正式 ? 詳述 ?詳述格式的例子,見(jiàn) pp5054(中譯本), pp6872(英文版) 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 37 ? 章節(jié)內(nèi)容 ? 緒言 ?范圍:系統(tǒng)用例,業(yè)務(wù)用例 ?級(jí)別:用戶目標(biāo)級(jí)別,子功能級(jí)別(可被許多用例重復(fù)使用的) ?主要角色 ?涉眾 ?前置條件和后置條件 ? 主成功場(chǎng)景和步驟(或基本流程) ? 擴(kuò)展(或替代流程) ? 特殊需求:非功能性需求,質(zhì)量屬性或約束 ? 技術(shù)和數(shù)據(jù)變?cè)恚罕热缬脩魧?duì)如何實(shí)現(xiàn)系統(tǒng)的要求 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 38 ? 指南 ? 以無(wú)界面約束的本質(zhì)風(fēng)格編寫(xiě)用例 ?發(fā)現(xiàn)目標(biāo)的目標(biāo), 可以拓寬我們的視野 ?What versus How ? What: 標(biāo)識(shí)我自己并獲得授權(quán) ? How ?通過(guò)對(duì)話框輸入用戶 ID和口令 ?生物識(shí)別 i ? Smart Card ?指南: “以本質(zhì)風(fēng)格編寫(xiě)用例,摒棄用戶界面并關(guān)注參與者的意圖” ?“具體風(fēng)格”需要在早期需求工作中避免 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 39 另外一個(gè)例子 ? Recycle Items: The user uses this machine to automatically have all the return items (bottles, cans, and crates) counted, and receives a receipt. The receipt is to be cashed at a cash register (machine). ? Add New Bottle Type: New kinds of bottles can be added to the machine by starting it in ?learning mode‘ and inserting 5 samples just like when returning items. In this way, the machine can measure the bottles and learn to identify them. The manager specifies the refund value for the new bottle type. 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 40 ? 編寫(xiě)簡(jiǎn)潔的用例 ? 編寫(xiě)黑盒用例 ?軟件元素具有責(zé)任( responsibility) ? 采用參與者和參與者目標(biāo)的觀點(diǎn) ?“對(duì)特定參與者而言具有價(jià)值的可觀察的結(jié)果” 如何發(fā)現(xiàn)用例 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 42 主要過(guò)程 ?選擇系統(tǒng)邊界 ?尋找主要參與者 ?為每個(gè)參與者確定他們的目標(biāo) ?定義用例 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 43 ?系統(tǒng)邊界描述了系統(tǒng)被包含在內(nèi)的“信封” ?在許多情形下,系統(tǒng)邊界是顯而易見(jiàn)的。例如對(duì)一個(gè)單個(gè)用戶的運(yùn)行在 Microsoft Windows上的個(gè)人聯(lián)系信息管理本,它的邊界是很容易定的,因?yàn)橹挥幸粋€(gè)用戶,一個(gè)平臺(tái)。 . 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 44 參與者與目標(biāo) ?選擇系統(tǒng)邊界 ?尋找主要參與者 ?為每個(gè)參與者確定他們的目標(biāo) ?定義用例 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 45 ?參與者是與系統(tǒng)交換數(shù)據(jù)的實(shí)體。參與者可以使用戶,外部的硬件或者另外一個(gè)系統(tǒng) 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 46 某些技巧 ?我們可以問(wèn)一些代表性的問(wèn)題來(lái)找到參與者和目標(biāo) ?參與者的類型 ? 主要的參與者 Primary Actors ? 支持參與者 Supporting Actors ? 幕后參與者 Offstage actors ?參與者 活動(dòng)列表 ? 這似乎一個(gè)交互和疊代的過(guò)程 The focus of this stage 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 47 ?主要的參與者和用戶目標(biāo)依賴于系統(tǒng)的邊界 G o a l : P r o c e s s s a l e sC a s h i e rC u s t o m e rP O S S y s t e mC h e c k o u t S e r v i c eG o a l : B u y i t e m sE n t e r p r i s e S e l l i n g T h i n g sS a l e s T a xA g e n c yG o a l : C o l l e c tt a x e s o n s a l e sS a l e s A c t i v i t yS y s t e mG o a l : A n a l y z e s a l e sa n d p e r f o r m a n c e d a t a上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 48 定義用例 ?選擇系統(tǒng)邊界 ?尋找主要參與者 ?為每個(gè)參與者確定他們的目標(biāo) ?定義用例 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 49 ?一般而言,為每一個(gè)用戶目標(biāo)定義用例 ? 用例名稱以動(dòng)詞開(kāi)頭 ? 將 CRUD (create, retrieve, update, delete)這些分散的目標(biāo)合并成一個(gè) CRUD用例 : Manage X ?定義用例需要交流和參與 ? 領(lǐng)域?qū)<业膮⑴c非常重要 ? 迭代開(kāi)發(fā) 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 50 ?發(fā)現(xiàn)有效用例 ? 用例的粒度問(wèn)題 ?大用例 ?我們的企業(yè)需要拓寬銷售渠道 ?整個(gè)系統(tǒng)就只有一個(gè)用例 !!! ?小的用例 ?輸入口令 ?系統(tǒng)中可能有成百上千個(gè)用例 !!! ?我們必須權(quán)衡 上海交通大學(xué)計(jì)算機(jī)科學(xué)與工程系 2020/11/4 51 ?經(jīng)驗(yàn)方法 ? 老板測(cè)試 ? EBP測(cè)