CRC
又稱為CRC索引卡片:CRC card
每張卡片代表一個類 Each card represents one class
每張卡片上寫出這個類承擔的職責、與其合作交互的其他類名
CRC cards are paper index cards on which one writes the responsibilities and collaborators of classes
CRC建模討論會
a group sitting around a table, discussing and writing on the cards as they play "what if" scenarios with the objects
considering what they must do and what other objects they must collaborate with
例如,廢品回收機
CRC 的特點
非正式的、不是很細節的 Informal, non-detailed
采用小組“頭腦風暴”的形式提出概念 Used for group brain-storming
CRC的目標不是提供完整的設計 Not intended to provide a complete design
CRC產生的結果需要進一步精化 End result is a first cut at classes for an object-oriented model
CRC 的輸入信息: 用例模型
用例模型
用例圖、邊界、用例描述,清楚 地描述了系統需求,作為CRC概 念類分析的起點
A good starting point for CRC analysis is a clear statement of all of the use-cases
Use-cases drive the introduction of CRC cards
用例描述的正常事件流、異常事件流, 可以作為CRC的“角色扮演”的腳本
Use-cases, or their accompanying scenarios, can be used as a kind of script for the role-playing method (角 色扮演)of checking the CRC cards
“角色扮演”也可以用順序圖來代替 The role-playing could be replaced with sequence diagrams
CRC方法建模的一些規則
CRC指導
Who Writes CRC Cards?
No one individual has all needed knowledge
Best to write CRC cards as a team, rather than individually
Analysis team should consist of five or six experienced individuals :
one or two user domain experts
one or two systems analysts
one OO software designer
one team facilitator and leader 一位引導者
The team can include clients 客戶 as well as developers
小的團隊關注點比較集中,大的團隊很難給出一致意見 Smaller teams lack diversity, larger teams make consensus difficult to achieve 仲裁者具備OO技能以及團隊引導能力,不是“老板”型
Facilitator should be skilled at OO and group techniques, not be a "boss" of team
圍繞團隊的提議來寫CRC Writing of CRC cards focuses team activities
切忌跑題:參見1994年春晚_相聲《跑題》關於開會的會風問題…
頭腦風暴 Brainstorming
Groups work by
收集各種各樣的想法,比較這些想法並進行合成
A "brainstorming" session is a good way to collect the ideas quickly and creatively
頭腦風暴的原則 Brainstorming principles
All ideas are potentially good ideas
Don't censure(責難) yourself or others -- all ideas are equal
Think fast and furiously激烈; ponder(沉思)later
A fast-paced discussion encourages individual creativity
Give every voice a turn
Include everyone in the group. Don't let the loudmouths dominate.
A little humor can be a powerful force
Humor can help break down barriers, relieve tension, and build trust needed for a cohesive and effective group
頭腦風暴的步驟
會議分階段,每階段目標明確 State session objectives.
Each session should have a precise objective--clear to all and narrow enough to accomplish in the session
Avoid digression (離題) from the objective
使用“輪轉”機制 Use a round-robin technique
Go around the group from individual to individual
Individuals may "pass" if they have nothing to contribute
Stop when no one has anything to contribute
討論與選擇 Discuss and select
一致同意的 Restate the objective, then identify those items that everyone agrees are "winners"
一致反對的 Then select those items that everyone disagrees are "losers"
需要進一步討論的 Then discuss the items remaining--the "maybes"
設置“時間盒”
在規定的時間間隔內有結論:或者完成、或者延遲到有進一步的信息到來,等等
在“頭腦風暴”開始之前,收集概念類可能的來源
每個參與者要完成一些調查、分析任務
閱讀所有的需求文檔 Read all requirements documents
Examine the formal requirements document (if any)
Don't overlook the indirect sources -- memos, meeting minutes, etc.
Circle nouns and noun phrases -- these are potential classes
仔細閱讀各類報告 Look carefully at reports
Examine the reports generated in the system being replaced (manual or automated)
Examine the profiles for the reports desired in the new system
Again circle nouns and noun phrases -- these are potential classes
做一些訪談 Conduct interviews
Talk to experienced users of the current system
Record interview or take careful, precise notes
Again identify nouns and noun phrases as candidate classes
概念類可能的來源 Sources for the Candidate Classes
檢查其他的文檔和文件 Examine documentation and files
當前系統的有關文件 Review the documentation on the current system
嘗試收集用戶、維護人員手里所擁有的非官方的、或者私人的筆記等
Try to review any unofficial or personal notes users or maintainers of the system have
同樣的,在里面尋找名稱 Again identify nouns and noun phrases as candidate classes
CRC尋找結束后 …
“角色扮演”驗證 概念類 Team can engage in role-playing to verify that use-case scenarios make sense for chosen CRC
每個人可以扮演1到多個類 Each person can role-play one or more class cards
如果哪里不順暢,立即修改 If something doesn’t work, change the class accordingly
或者,去修改用例!(需求定義錯了哦)Revision of use-cases might also be indicated