Professional Documents
Culture Documents
Massimo Felici
Massimo Felici
c 20042011
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 modelling
Massimo Felici
c 20042011
CRC Cards
CRC Cards explicitly represent multiple objects simultaneously 1. The Name of 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
Massimo Felici
c 20042011
Design by Responsibilities
Responsibility-based Modelling allows The identication of the components from which the system is constructed The allocation of responsibilities to system components The identication 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)
Massimo Felici
c 20042011
3 Name the required responsibilities to carry a scenario toward 4 Make sure that each component has sucient 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
Massimo Felici
c 20042011
Design Activities
1. Preparation: collection and selection of use cases 2. Invention: (incremental) identication of components and responsibilities 3. Evaluation: questions and scenarios stress test the design 4. Consolidation: further assessment of the tested components 5. Documentation: recording identied reasons and scenarios
Massimo Felici
c 20042011
Massimo Felici
c 20042011
Example Requirements
A Library System
1. The library system must keep track of when books are borrowed and returned 2. The system must support librarian work 3. The library is open to university sta and students 4. University sta can borrow up to 25 dierent books 5. Students can borrow up to 15 dierent books
Massimo Felici
c 20042011
A Library System
Massimo Felici
c 20042011
10
A Library System
Massimo Felici
c 20042011
11
A Library System
Massimo Felici
c 20042011
12
A Library System
Massimo Felici
c 20042011
13
Massimo Felici
c 20042011
14
Massimo Felici
c 20042011
15
Massimo Felici
c 20042011
16
When to Refactor?
When you are adding a function to your design (program) and you nd the old design (code) getting in the way When you are looking at design (code) and having diculty understanding it
Massimo Felici
c 20042011
17
Massimo Felici
c 20042011
18
Massimo Felici
c 20042011
19
20
Readings
Required Readings K. Beck, W. Cunningham. A Laboratory for Teaching Object-Oriented Thinking. In Conference Proceedings on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 89), ACM, pp. 1-6. Suggested Readings T. Mens, T. Tourwe. A survey of software refactoring. IEEE Transactions on Software Engineering, vol.30, no.2, pp. 126-139, February, 2004.
Massimo Felici
c 20042011
21
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
Massimo Felici Validation: CRC Cards c 20042011