SlideShare a Scribd company logo
1 of 22
Download to read offline
Validation: CRC Cards
Massimo Felici
JCMB-1402 0131 650 5899
1BP-G04 0131 650 4408
mfelici@inf.ed.ac.uk
© 2004-2007 SEOC - Lecture Note 05 2
What are CRC Cards?
CRC: “Class-Responsibility-Collaborator”
CRC cards provide the means to validate the
class model with the use case model
Responsibilities are a way to state the
rationale of the system design
CRC cards support responsibility-based
modeling
© 2004-2007 SEOC - Lecture Note 05 3
Design by Responsibilities
Responsibility-based Modeling allows
• The identification of the components from which
the system is constructed
• The allocation of responsibilities to system
components
• The identification of the services (or
functionalities) provided by them
• The assessment how components satisfy the
requirements as stated by the use cases
Types of Responsibilities
• To do something (active responsibilities)
• To provide information (acting as a contact point)
© 2004-2007 SEOC - Lecture Note 05 4
Design Activities
1. Preparation: collection and selection of use
cases
2. Invention: (incremental) identification of
components and responsibilities
3. Evaluation: questions and scenarios stress
test the design
4. Consolidation: further assessment of the
tested components
5. Documentation: recording identified
reasons and scenarios
© 2004-2007 SEOC - Lecture Note 05 5
Steps in Responsibility-based Design
1. Identify scenarios of use; bound
the scope of design
2. Role play the scenarios, evaluating
responsibilities
3. Name the required responsibilities
to carry a scenario toward
4. Make sure that each component
has sufficient information and
ability to carry out its
responsibility
5. Consider variations of the
scenario; check the stability of
the responsibility
6. Evaluate the components
7. Ask the volatility/stability of the
component
8. Create variations
9. Run through the variant scenarios
to investigate the stability of the
components and responsibilities
10. Simulate if possible
11. Consolidate the components by
level
12. Identify subsystems
13. Identify the different levels
14. Document the design rationale and
key scenarios
15. Decide which scenarios to
document
16. List the components being used
that already exist
17. Specify each new component
© 2004-2007 SEOC - Lecture Note 05 6
CRC Cards: How do they look like?
CRC Cards explicitly represent multiple
objects simultaneously
1. The Name if the class it refers to
2. The Responsibilities of the class. These should be
high level, not at the level of individual methods
3. The Collaborators that help discharge a
responsibility
Class Name
Collaborators
…
Responsibilities
…
1
2
3
© 2004-2007 SEOC - Lecture Note 05 7
CRC Cards in Design Development
1. Work using role play. Different individuals are
different objects
2. Pick a use case to building a scenario to hand
simulate
3. Start with the person who has the card with the
responsibility to initiate the use case
4. In discharging a responsibility a card owner may
only talk to collaborators for that responsibility
5. Gaps must be repaid and re-tested against the use
case
© 2004-2007 SEOC - Lecture Note 05 8
Using CRC Cards
1. Choose a coherent set of use cases
2. Put a card on the table
3. Walk through the scenario, naming cards and
responsibilities
4. Vary the situations (i.e., assumptions on the use
case), to stress test the cards
5. Add cards, push cards to the side, to let the
design evolve (that is, evaluate different design
alternatives)
6. Write down the key responsibility decisions and
interactions
© 2004-2007 SEOC - Lecture Note 05 9
A Design Example
A Library System
The library system must keep track of when books
are borrowed and returned
The system must support librarian work
The library is open to university staff and students
© 2004-2007 SEOC - Lecture Note 05 10
A Design Example
Borrower
Record
Record
Borrow book
Return book
Record
CopyKeep track
Copy
Librarian
Book
Record:
Borrowed or
Returned
Book copies
Book
Book information
Number of
available copies
© 2004-2007 SEOC - Lecture Note 05 11
Playing CRC Cards
Borrower
Record
Record
Borrow book
Return book
1
2
3
Record
CopyKeep track
4
5
6
Copy
Librarian
Book
Record:
Borrowed or
Returned
Book copies
7
88
99
Book
Book
information
Number of
available copies10
© 2004-2007 SEOC - Lecture Note 05 12
What CRC Card help with
Check use case can be achieved
Check associations are correct
Check generalizations are correct
Detect omitted classes
Detect opportunities to refactor the class
model. That is: to move responsibilities
about (and operations in the class model)
without altering the overall responsibility of
the system
© 2004-2007 SEOC - Lecture Note 05 13
CRC Cards and Quality
Too many responsibilities
• This indicates low cohesion in the system
• Each class should have at most three or four responsibilities
• Classes with more responsibilities should be split if possible
Too many collaborators
• This indicates high coupling
• It may be the division of the responsibilities amongst the
classes is wrong
CRC Cards
• provide a good, early, measure of the quality of the system
(design). Solving problems now is better that later.
• are flexible – use them to record changes during validation
© 2004-2007 SEOC - Lecture Note 05 14
Using CRC Cards: An Example
Specimen Use Cases
1. Patient admitted to ward.
When a patient arrives on a
ward, a duty nurse must
create a new record for this
patient and allocate them to
a bed.
2. Nurse handover. The senior
duty nurse at the end of
their shift must inform the
new staff of any changes
during the previous shift
(i.e., new patients, patients
discharged, changes in
patient health, changes to
bed status or allocations).
NHS Trust Manager
Hospital
…
Initialize system
Check free beds
…
© 2004-2007 SEOC - Lecture Note 05 15
Using CRC Cards: An Example continued
Nurse
Record,Bed
Record
Bed
Bed, Record
…
Admit patients
Update patient records
Reserve beds
Discharge patients
…
Record
Nurse
…
Is_updated
…
Bed
Nurse, Record
Nurse
…
Is_allocated
Is_reserved
…
© 2004-2007 SEOC - Lecture Note 05 16
Principles for Refactoring
Do not do both refactoring and adding
functionality at the same time
Make sure you have good tests before you
begin refactoring
Take short deliberate steps
© 2004-2007 SEOC - Lecture Note 05 17
When to Refactor?
When you are adding a function to your
design (program) and you find the old design
(code) getting in the way
When you are looking at design (code) and
having difficulty understanding it
© 2004-2007 SEOC - Lecture Note 05 18
OO Design using CRC Cards
1. Review quality of class model
2. Identify opportunities for refactoring
3. Identify (new) classes that support system
implementation
4. Identify further details (e.g., sub-
responsibilities of class responsibilities,
attributes, object creations, destructions
and lifetimes, passed data, etc.)
© 2004-2007 SEOC - Lecture Note 05 19
OO Analysis using CRC Cards
1. Session focuses on a part of requirements
2. Identify classes (e.g., noun-phrase
analysis)
3. Construct CRC cards for these and assign
to members
4. Add responsibilities to classes
5. Role-play scenarios to identify
collaborators
© 2004-2007 SEOC - Lecture Note 05 20
Common Domain Modeling Mistakes
Overlay specific noun-phrase analysis
Counter-intuitive or incomprehensible class
and association names
Assigning multiplicities to associations too
soon
Addressing implementation issues too early
• Presuming a specific implementation strategy
• Committing to implementation constructs
• Tackling implementation issues (e.g., integrating
legacy systems)
Optimizing for reuse before checking use
cases achieved
© 2004-2007 SEOC - Lecture Note 05 21
(Suggested) Readings
Readings
K. Beck, W. Cunningham. A Laboratory for
Teaching Object-Oriented Thinking. In
Proceedings of OOPSLA ’89.
Suggested Readings
A. Cockburn’s papers
• Responsibility-based Modeling
• Using CRC Cards
© 2004-2007 SEOC - Lecture Note 05 22
Summary
We should try to check the completeness of
the class model (early assurance the model
is correct)
CRC Cards are a simple way of doing this
CRC Cards support responsibility-based
modeling and design
CRC Cards identify errors and omissions
They also give an early indication of quality
Use the experience of simulating the system
to refactor if this necessary

More Related Content

What's hot

rmoore.smartquery KScope15
rmoore.smartquery KScope15rmoore.smartquery KScope15
rmoore.smartquery KScope15Ron Moore
 
ARS Ted Grossardt and John Ripy, Kentucky Tranportation Center and Laxmi Rama...
ARS Ted Grossardt and John Ripy, Kentucky Tranportation Center and Laxmi Rama...ARS Ted Grossardt and John Ripy, Kentucky Tranportation Center and Laxmi Rama...
ARS Ted Grossardt and John Ripy, Kentucky Tranportation Center and Laxmi Rama...Stephanie Camay
 
Socio organizational issues ppt
Socio organizational issues pptSocio organizational issues ppt
Socio organizational issues ppttamizh arthanari
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignAmr E. Mohamed
 
Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling
Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modelingBeit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling
Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modelingbabak danyal
 
Chapter 11 designing interfaces and dialogues
Chapter 11 designing interfaces and dialoguesChapter 11 designing interfaces and dialogues
Chapter 11 designing interfaces and dialoguesJob Master
 

What's hot (11)

rmoore.smartquery KScope15
rmoore.smartquery KScope15rmoore.smartquery KScope15
rmoore.smartquery KScope15
 
C++ Unit_01
C++ Unit_01C++ Unit_01
C++ Unit_01
 
Marta de la Cruz-Informe Final
Marta de la Cruz-Informe FinalMarta de la Cruz-Informe Final
Marta de la Cruz-Informe Final
 
Unit iii ppt
Unit iii pptUnit iii ppt
Unit iii ppt
 
Chapter5
Chapter5Chapter5
Chapter5
 
ARS Ted Grossardt and John Ripy, Kentucky Tranportation Center and Laxmi Rama...
ARS Ted Grossardt and John Ripy, Kentucky Tranportation Center and Laxmi Rama...ARS Ted Grossardt and John Ripy, Kentucky Tranportation Center and Laxmi Rama...
ARS Ted Grossardt and John Ripy, Kentucky Tranportation Center and Laxmi Rama...
 
Socio organizational issues ppt
Socio organizational issues pptSocio organizational issues ppt
Socio organizational issues ppt
 
User Support
User SupportUser Support
User Support
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and Design
 
Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling
Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modelingBeit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling
Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling
 
Chapter 11 designing interfaces and dialogues
Chapter 11 designing interfaces and dialoguesChapter 11 designing interfaces and dialogues
Chapter 11 designing interfaces and dialogues
 

Similar to Lecture note05 slides

Student Name Daniel RosadoCourseCIS339Session (month, ye.docx
Student Name Daniel RosadoCourseCIS339Session (month, ye.docxStudent Name Daniel RosadoCourseCIS339Session (month, ye.docx
Student Name Daniel RosadoCourseCIS339Session (month, ye.docxemelyvalg9
 
Trends and innovations in database course
Trends and innovations in database courseTrends and innovations in database course
Trends and innovations in database courseNeetu Sardana
 
From use case to software architecture
From use case to software architectureFrom use case to software architecture
From use case to software architectureAhmad karawash
 
Object oriented software engineering
Object oriented software engineeringObject oriented software engineering
Object oriented software engineeringVarsha Ajith
 
Student Name CourseCIS339Session (month, year)032019.docx
Student Name CourseCIS339Session (month, year)032019.docxStudent Name CourseCIS339Session (month, year)032019.docx
Student Name CourseCIS339Session (month, year)032019.docxcpatriciarpatricia
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfB.T.L.I.T
 
Creating a Use Case
Creating a Use Case                                               Creating a Use Case
Creating a Use Case CruzIbarra161
 
OOSE Unit 3 PPT.ppt
OOSE Unit 3 PPT.pptOOSE Unit 3 PPT.ppt
OOSE Unit 3 PPT.pptitadmin33
 
Exam – june 2010 – qp 11
Exam – june 2010 – qp 11Exam – june 2010 – qp 11
Exam – june 2010 – qp 11nic_vickers
 
A laboratory for teaching object oriented thinking
A laboratory for teaching object oriented thinkingA laboratory for teaching object oriented thinking
A laboratory for teaching object oriented thinkingHome
 
Credential Transparency Initiative (CTI) Step 1 – Functional Requirements
Credential Transparency Initiative (CTI)Step 1 – Functional RequirementsCredential Transparency Initiative (CTI)Step 1 – Functional Requirements
Credential Transparency Initiative (CTI) Step 1 – Functional RequirementsIllinois workNet
 
HND Assignment Brief Session Sept.docx
              HND Assignment Brief               Session Sept.docx              HND Assignment Brief               Session Sept.docx
HND Assignment Brief Session Sept.docxjoyjonna282
 
Oose unit 3 ppt
Oose unit 3 pptOose unit 3 ppt
Oose unit 3 pptDr VISU P
 
As Applied ICT term 3 Ex 10
As Applied ICT term 3 Ex 10As Applied ICT term 3 Ex 10
As Applied ICT term 3 Ex 10Jordan_0009
 
Ch 6 only 1. Distinguish between a purpose statement, research p
Ch 6 only 1. Distinguish between a purpose statement, research pCh 6 only 1. Distinguish between a purpose statement, research p
Ch 6 only 1. Distinguish between a purpose statement, research pMaximaSheffield592
 
Ch 6 only 1. distinguish between a purpose statement, research p
Ch 6 only 1. distinguish between a purpose statement, research pCh 6 only 1. distinguish between a purpose statement, research p
Ch 6 only 1. distinguish between a purpose statement, research pnand15
 
Systems Analysis and Design 9th Edition Kendall Solutions Manual
Systems Analysis and Design 9th Edition Kendall Solutions ManualSystems Analysis and Design 9th Edition Kendall Solutions Manual
Systems Analysis and Design 9th Edition Kendall Solutions Manualbijavotyz
 

Similar to Lecture note05 slides (20)

Student Name Daniel RosadoCourseCIS339Session (month, ye.docx
Student Name Daniel RosadoCourseCIS339Session (month, ye.docxStudent Name Daniel RosadoCourseCIS339Session (month, ye.docx
Student Name Daniel RosadoCourseCIS339Session (month, ye.docx
 
Trends and innovations in database course
Trends and innovations in database courseTrends and innovations in database course
Trends and innovations in database course
 
From use case to software architecture
From use case to software architectureFrom use case to software architecture
From use case to software architecture
 
Object oriented software engineering
Object oriented software engineeringObject oriented software engineering
Object oriented software engineering
 
Student Name CourseCIS339Session (month, year)032019.docx
Student Name CourseCIS339Session (month, year)032019.docxStudent Name CourseCIS339Session (month, year)032019.docx
Student Name CourseCIS339Session (month, year)032019.docx
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdf
 
Creating a Use Case
Creating a Use Case                                               Creating a Use Case
Creating a Use Case
 
OOSE Unit 3 PPT.ppt
OOSE Unit 3 PPT.pptOOSE Unit 3 PPT.ppt
OOSE Unit 3 PPT.ppt
 
Exam – june 2010 – qp 11
Exam – june 2010 – qp 11Exam – june 2010 – qp 11
Exam – june 2010 – qp 11
 
Scenario 4
Scenario 4Scenario 4
Scenario 4
 
Scenario 4
Scenario 4Scenario 4
Scenario 4
 
Building an Information System
Building an Information SystemBuilding an Information System
Building an Information System
 
A laboratory for teaching object oriented thinking
A laboratory for teaching object oriented thinkingA laboratory for teaching object oriented thinking
A laboratory for teaching object oriented thinking
 
Credential Transparency Initiative (CTI) Step 1 – Functional Requirements
Credential Transparency Initiative (CTI)Step 1 – Functional RequirementsCredential Transparency Initiative (CTI)Step 1 – Functional Requirements
Credential Transparency Initiative (CTI) Step 1 – Functional Requirements
 
HND Assignment Brief Session Sept.docx
              HND Assignment Brief               Session Sept.docx              HND Assignment Brief               Session Sept.docx
HND Assignment Brief Session Sept.docx
 
Oose unit 3 ppt
Oose unit 3 pptOose unit 3 ppt
Oose unit 3 ppt
 
As Applied ICT term 3 Ex 10
As Applied ICT term 3 Ex 10As Applied ICT term 3 Ex 10
As Applied ICT term 3 Ex 10
 
Ch 6 only 1. Distinguish between a purpose statement, research p
Ch 6 only 1. Distinguish between a purpose statement, research pCh 6 only 1. Distinguish between a purpose statement, research p
Ch 6 only 1. Distinguish between a purpose statement, research p
 
Ch 6 only 1. distinguish between a purpose statement, research p
Ch 6 only 1. distinguish between a purpose statement, research pCh 6 only 1. distinguish between a purpose statement, research p
Ch 6 only 1. distinguish between a purpose statement, research p
 
Systems Analysis and Design 9th Edition Kendall Solutions Manual
Systems Analysis and Design 9th Edition Kendall Solutions ManualSystems Analysis and Design 9th Edition Kendall Solutions Manual
Systems Analysis and Design 9th Edition Kendall Solutions Manual
 

Recently uploaded

4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Celine George
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfChristalin Nelson
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 

Recently uploaded (20)

4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdf
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 

Lecture note05 slides

  • 1. Validation: CRC Cards Massimo Felici JCMB-1402 0131 650 5899 1BP-G04 0131 650 4408 mfelici@inf.ed.ac.uk
  • 2. © 2004-2007 SEOC - Lecture Note 05 2 What are CRC Cards? CRC: “Class-Responsibility-Collaborator” CRC cards provide the means to validate the class model with the use case model Responsibilities are a way to state the rationale of the system design CRC cards support responsibility-based modeling
  • 3. © 2004-2007 SEOC - Lecture Note 05 3 Design by Responsibilities Responsibility-based Modeling allows • The identification of the components from which the system is constructed • The allocation of responsibilities to system components • The identification of the services (or functionalities) provided by them • The assessment how components satisfy the requirements as stated by the use cases Types of Responsibilities • To do something (active responsibilities) • To provide information (acting as a contact point)
  • 4. © 2004-2007 SEOC - Lecture Note 05 4 Design Activities 1. Preparation: collection and selection of use cases 2. Invention: (incremental) identification of components and responsibilities 3. Evaluation: questions and scenarios stress test the design 4. Consolidation: further assessment of the tested components 5. Documentation: recording identified reasons and scenarios
  • 5. © 2004-2007 SEOC - Lecture Note 05 5 Steps in Responsibility-based Design 1. Identify scenarios of use; bound the scope of design 2. Role play the scenarios, evaluating responsibilities 3. Name the required responsibilities to carry a scenario toward 4. Make sure that each component has sufficient information and ability to carry out its responsibility 5. Consider variations of the scenario; check the stability of the responsibility 6. Evaluate the components 7. Ask the volatility/stability of the component 8. Create variations 9. Run through the variant scenarios to investigate the stability of the components and responsibilities 10. Simulate if possible 11. Consolidate the components by level 12. Identify subsystems 13. Identify the different levels 14. Document the design rationale and key scenarios 15. Decide which scenarios to document 16. List the components being used that already exist 17. Specify each new component
  • 6. © 2004-2007 SEOC - Lecture Note 05 6 CRC Cards: How do they look like? CRC Cards explicitly represent multiple objects simultaneously 1. The Name if the class it refers to 2. The Responsibilities of the class. These should be high level, not at the level of individual methods 3. The Collaborators that help discharge a responsibility Class Name Collaborators … Responsibilities … 1 2 3
  • 7. © 2004-2007 SEOC - Lecture Note 05 7 CRC Cards in Design Development 1. Work using role play. Different individuals are different objects 2. Pick a use case to building a scenario to hand simulate 3. Start with the person who has the card with the responsibility to initiate the use case 4. In discharging a responsibility a card owner may only talk to collaborators for that responsibility 5. Gaps must be repaid and re-tested against the use case
  • 8. © 2004-2007 SEOC - Lecture Note 05 8 Using CRC Cards 1. Choose a coherent set of use cases 2. Put a card on the table 3. Walk through the scenario, naming cards and responsibilities 4. Vary the situations (i.e., assumptions on the use case), to stress test the cards 5. Add cards, push cards to the side, to let the design evolve (that is, evaluate different design alternatives) 6. Write down the key responsibility decisions and interactions
  • 9. © 2004-2007 SEOC - Lecture Note 05 9 A Design Example A Library System The library system must keep track of when books are borrowed and returned The system must support librarian work The library is open to university staff and students
  • 10. © 2004-2007 SEOC - Lecture Note 05 10 A Design Example Borrower Record Record Borrow book Return book Record CopyKeep track Copy Librarian Book Record: Borrowed or Returned Book copies Book Book information Number of available copies
  • 11. © 2004-2007 SEOC - Lecture Note 05 11 Playing CRC Cards Borrower Record Record Borrow book Return book 1 2 3 Record CopyKeep track 4 5 6 Copy Librarian Book Record: Borrowed or Returned Book copies 7 88 99 Book Book information Number of available copies10
  • 12. © 2004-2007 SEOC - Lecture Note 05 12 What CRC Card help with Check use case can be achieved Check associations are correct Check generalizations are correct Detect omitted classes Detect opportunities to refactor the class model. That is: to move responsibilities about (and operations in the class model) without altering the overall responsibility of the system
  • 13. © 2004-2007 SEOC - Lecture Note 05 13 CRC Cards and Quality Too many responsibilities • This indicates low cohesion in the system • Each class should have at most three or four responsibilities • Classes with more responsibilities should be split if possible Too many collaborators • This indicates high coupling • It may be the division of the responsibilities amongst the classes is wrong CRC Cards • provide a good, early, measure of the quality of the system (design). Solving problems now is better that later. • are flexible – use them to record changes during validation
  • 14. © 2004-2007 SEOC - Lecture Note 05 14 Using CRC Cards: An Example Specimen Use Cases 1. Patient admitted to ward. When a patient arrives on a ward, a duty nurse must create a new record for this patient and allocate them to a bed. 2. Nurse handover. The senior duty nurse at the end of their shift must inform the new staff of any changes during the previous shift (i.e., new patients, patients discharged, changes in patient health, changes to bed status or allocations). NHS Trust Manager Hospital … Initialize system Check free beds …
  • 15. © 2004-2007 SEOC - Lecture Note 05 15 Using CRC Cards: An Example continued Nurse Record,Bed Record Bed Bed, Record … Admit patients Update patient records Reserve beds Discharge patients … Record Nurse … Is_updated … Bed Nurse, Record Nurse … Is_allocated Is_reserved …
  • 16. © 2004-2007 SEOC - Lecture Note 05 16 Principles for Refactoring Do not do both refactoring and adding functionality at the same time Make sure you have good tests before you begin refactoring Take short deliberate steps
  • 17. © 2004-2007 SEOC - Lecture Note 05 17 When to Refactor? When you are adding a function to your design (program) and you find the old design (code) getting in the way When you are looking at design (code) and having difficulty understanding it
  • 18. © 2004-2007 SEOC - Lecture Note 05 18 OO Design using CRC Cards 1. Review quality of class model 2. Identify opportunities for refactoring 3. Identify (new) classes that support system implementation 4. Identify further details (e.g., sub- responsibilities of class responsibilities, attributes, object creations, destructions and lifetimes, passed data, etc.)
  • 19. © 2004-2007 SEOC - Lecture Note 05 19 OO Analysis using CRC Cards 1. Session focuses on a part of requirements 2. Identify classes (e.g., noun-phrase analysis) 3. Construct CRC cards for these and assign to members 4. Add responsibilities to classes 5. Role-play scenarios to identify collaborators
  • 20. © 2004-2007 SEOC - Lecture Note 05 20 Common Domain Modeling Mistakes Overlay specific noun-phrase analysis Counter-intuitive or incomprehensible class and association names Assigning multiplicities to associations too soon Addressing implementation issues too early • Presuming a specific implementation strategy • Committing to implementation constructs • Tackling implementation issues (e.g., integrating legacy systems) Optimizing for reuse before checking use cases achieved
  • 21. © 2004-2007 SEOC - Lecture Note 05 21 (Suggested) Readings Readings K. Beck, W. Cunningham. A Laboratory for Teaching Object-Oriented Thinking. In Proceedings of OOPSLA ’89. Suggested Readings A. Cockburn’s papers • Responsibility-based Modeling • Using CRC Cards
  • 22. © 2004-2007 SEOC - Lecture Note 05 22 Summary We should try to check the completeness of the class model (early assurance the model is correct) CRC Cards are a simple way of doing this CRC Cards support responsibility-based modeling and design CRC Cards identify errors and omissions They also give an early indication of quality Use the experience of simulating the system to refactor if this necessary