CSC/ECE 517 Fall 2010/ch1 S6 JC: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
Line 1: Line 1:
'''==CRC CARDS=='''
please review our new wiki page


== '''Introduction''' ==
http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2010/ch3_3j_cj
 
Class-Responsibility-Collaborator is a simple Object oriented Analysis technique. They are also used as a successful modeling and collaborating design of a system. It basically an index card used to represent a class of objects, their behavior and their interactions. The cards are created through scenarios, based on the system requirements that model the behavior of the system.
 
CRC cards where introduced by Kent Beck and Ward Cunningham in there paper "A Laboratory for Teaching Object-Oriented Thinking" released in OOPLSA '89. There original purpose was to teach programmers the object-oriented paradigm.       
It consists of
 
1. Class
 
2. Responsibility
 
3. Collaborator
'''Class:''' A class represents an abstract characteristics of things (or Objects) and its characteristics ( or attributes). It is a user defined data type which contains all the variables, properties and methods in it. A class name is present on the top of the CRC card.
 
'''Responsibility:''' Responsibility indicates what a class knows or does. It is basically all the variables and methods a class has. A class can change the values of what it knows but not what other classes know. The responsibilities of a class are present on the left of the CRC card.
 
'''Collaborator:''' With each responsibility you indicate which other classes you need to work with to fulfill it. This gives you some idea of the links between classes. The collaborators of a class are present on the right side of the CRC card.
 
== '''Why use CRC cards?''' ==
 
 
1. They are portable. They can be used anywhere since they do not require computers.
 
2. They give us a brief idea of how the system is modeled. They also explain how the system works with respect to different situations.
 
3. They are a useful tool for teaching people the object-oriented paradigm.
 
4. They can be used as a methodology themselves or as a front end to a more formal methodology such as UML.
 
== '''Format ''' ==
 
A standard CRC would look as follows. It has a class name at the top. The card is divided into two parts. The left part contains responsibilities and the right part contains Collaborators.
 
 
[[Image:Example1.jpg]]
 
 
Each class has its own CRC card. A CRC card might also be helpful in finding out about how classes collaborate like which class initiates the flow of data.
 
== '''Creating CRC cards''' ==
 
CRC card creation is an iterative brain-storming process. CRC cards are created following the below steps:
 
'''1. Select a set of use cases:'''
Decide on how to design CRC cards as to work opposed to the object interaction diagrams or work in conjunction with object interaction diagrams. Select a set of use cases so that they are related to different object types.
 
'''2. Label the Cards:  '''                                                     
Just name the cards with distinct classes and name the initial responsibilities.
 
'''3. Test various scenarios:'''
Test the scenarios, identify new classes, assign new responsibilities and add them to the class. In brain storming session, various responsibilities of classes are identified and named.
'''
4. Stress test the cards:'''
To achieve an efficient design, test the cards in various new scenario's that may arise. Design the cards such that only one card is added to the set. If there seems to be a need to create a new object, then add a new card.
               
'''5. Add cards, Let designs evolve:'''
Some cards added at the initial phase may seem unnecessary later, but as design evolves, add new cards and push inital cards aside.
'''6. Refine:'''
Factor out complexity. Remove any attributes if present in responsibilities. See the relationships between various cards. Improve the various collaborations.
 
== '''Example''' ==
 
 
 
LIBRARY SYSTEM:
 
* The library system consists of students and staff borrowing books.
 
* The librarian is present.
 
* The library system needs to keep track of the books borrowed and returned.
 
The CRC cards are:
 
[[Image:Example2.jpg]]
 
The borrower borrows the book and returns the book after the designated duration.
He interacts with the record to get and return the book.
 
[[Image:Example3.jpg]]
 
The record is responsible for keeping track of the books in the library.
 
[[Image:Example4.jpg]]
 
The book class has the information about the book and the number of copies available.
 
[[Image:Example5.jpg]]
 
The class copy has the information about the book and various collaborations.
 
== '''REFERENCES''' ==
 
1. http://c2.com/doc/oopsla89/paper.html
 
2. http://www.cs.unc.edu/~stotts/145/CRC/crc.html
 
3. http://www.matthewtmead.com/blog/?p=74
 
4. http://www1.sce.umkc.edu/~mullinsj/it350/lectures/CRCCardsTutorial.htm

Latest revision as of 01:13, 11 October 2010