CSC/ECE 517 Fall 2012/ch1 w43: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
(69 intermediate revisions by the same user not shown)
Line 2: Line 2:
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.


__TOC__


== Introduction ==
== Introduction ==
Line 7: Line 9:
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.


A CRC-card corresponds to a '''class'''.
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class "helping" to fulfill a specific responsibility.
 
A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card.
 
A '''collaborator''' is an object of another class "helping" to fulfill a specific responsibility.


The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.


The structure of a CRC-card is as shown below.
The structure of a CRC-card is as shown below.


[[File:CRC_example.jpg]]
[[File:CRC_example.jpg|center|x300px]]


CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:
Line 34: Line 31:
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.


A common method to determine what cards should be created is to read a specification for the program being designed and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.




Line 43: Line 40:
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.


[[File:Crc_model.PNG]]
 
[[File:Crc_model.PNG|center|x300px]]




== Creating a CRC model ==
== Creating a CRC model ==


The CRC-card approach is especially well suited, when the problem is not well defined. During object-oriented analysis, the problem and the application domains are analysed to understand the problem at hand. The steps in creating a CRC model are as follows:
* Find candidate classes by means of brainstorming
* Filter the list of candidates


The steps in creating a CRC model are:
* Create CRC-cards for the remaining candidates


1.  Put together the CRC modeling team.
* Allocate responsibilities to CRC-cards/classes


2.  Organize the modeling room.
* Define scenarios to test/evaluate our model


3.  Do some brainstorming.
* Prepare the group session


4.  Explain the CRC modeling technique.
* "Role-play" scenarios using CRC-cards


5. Iteratively perform the steps of CRC modeling.
* Record scenarios and
6.  Perform use-case scenario testing


* Update CRC-cards and scenarios to reflect your findings (6.9).


== Example CRC ==
These steps need not be performed in strict sequence. When filtering the list of candidates, usually all possible responsibilities should be considered in order to be able to make an informed decision. The last three steps are generally always performed in parallel.
 
== Example of a CRC card ==
The CRC card for a class ''Book'' is as shown below:
The CRC card for a class ''Book'' is as shown below:


[[File:Book_example.JPG|center|x300px]]




A CRC card corresponds to a class. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly.
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.


A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card. 
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.


== Advantages of CRC cards ==
== Advantages of CRC cards ==


* '''It’s simple and straightforward''': You get a group of people together in a room and fill out a bunch of index cards. Because of its simplicity you can explain CRC modeling to a group of people in 10 or 15 minutes.
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.


* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.
* '''Life Cycle''': CRC cards are useful throughout the life cycle.
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.
* '''Increased user participation''': Because users are actively involved in defining the model their satisfaction with the work will be much greater
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .
* '''Prototyping''': CRC modeling and prototyping are both iterative processes in which users are greatly involved. It is very common to draw rough sketches of screens and reports during CRC modeling sessions.
* '''Class diagramming''': CRC modeling leads directly into class diagramming. CRC models and class diagrams show many of the same concepts.


== Disadvantages of CRC cards ==
== Disadvantages of CRC cards ==
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.


* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.


* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.


= CRC card tools =
= CRC card tools =
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.
== Stickies ==
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.
{|
|[[File:Stickies.png|x300px]]
|[[File:Stickynotes1.png|x300px]]
|}
== Hot Draw ==
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application.
{| style="margin: 1em auto 1em auto"
|+
! ||
|-
| [[File:JHotDraw.PNG|x287px]]
|}
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.


As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of "http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]" fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.


== QuickCRC ==
== QuickCRC ==
Line 89: Line 143:
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.


[[File:675px-Quickcrc.PNG]]
 
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]
 
 
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.
 
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.
 
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]
 
A few popular features used in this tool are :
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.
*It can generate the inheritance graphs from the information on the CRC cards.
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.
*Information can be exported to other development tools as the CRC cards can be exported to MacA&D, WinA&D or QuickUML to auto-generate UML class diagrams.
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.
 


== Easy CRC ==
== Easy CRC ==


The use of the '''Easy CRC''' tool is divided into two: First, it helps in identifying the object, which are the CRC cards, from plain regular language and second, it identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.
The use of the '''Easy CRC''' tool is divided into two categories:
* It helps in identifying the object, which are the CRC cards, from plain regular language.
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.
 
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.
 
There are two ways to update the responsibilities and collaborators in CRC diagram.
* Firstly, Enter all the values manually.
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.
 
{|
|[[File:438px-EasyCRC2.png|x300px]]
|[[File:517px-EasyCRC1.png|x300px]]
|}
 
 
== Software Ideas Modeler ==
 
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.
 
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.
 
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.
 
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎
 
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.
 
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be "too much" information depending on one's opinion on the required elements of a CRC card.
 
 
== Visual Paradigm for UML ==
 
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.
 
{|
|[[File:File-Crc-visual.png|x300px]]
|[[File:File-Edit description.png|x300px]]
|}
 
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.
 
Other than providing the common CRC-related functionalities, it has the following peculiarities:
* Record audio to associate to a diagram.
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)
* Directly generating java code in eclipse with the class diagram.
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)
* It can generate UML class diagrams automatically out of the CRD cards.
* Cannot drag and drop values from one card to the other.
 
 
= Comparison and Trade Off between tools =
 
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:
 
{| class="wikitable" style="margin: 1em auto 1em auto"
|+ '''Tools feature comparison'''
! Feature || QuickCRC || VP UML || SIM || HD || Stickies
|- align="center"
| Model scenarios || ✔ || || ✔ || ||
|- align="center"
| Drag values from card to card || ✔ || || || ✔ ||
|- align="center"
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||
|- align="center"
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||
|- align="center"
| Generate Java code ||  || ✔ || ✔ ||  ||
|- align="center"
| Collapse/expand cards || ✔ ||  || ||  || ✔
|- align="center"
| Display/hide parts of a card ||  || ✔ || ||  ||
|- align="center"
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||
|- align="center"
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔
|- align="center"
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||
|- align="center"
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||
|}
 
= Conclusion =
 
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design.
 
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.
 
= See Also =
* [http://www.runrev.com/home/ Revolution]
* [http://pythoncard.sourceforge.net/ PythonCard]
* [http://www.supercard.us/supercard/index.html SuperCard]
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]
 
= References =
 
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js
* http://www.excelsoftware.com/quickcrcintro
* https://sites.google.com/site/easycrc/
* Beck, Kent; Cunningham, Ward (October 1989), "A laboratory for teaching object oriented thinking", ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7
* http://www.cs.uakron.edu/~xiao/oop/CRC-S.ppt
* http://www.uml.org.cn/umlapplication/pdf/crcmodeling.pdf
* http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card
* http://c2.com/cgi/wiki?WardAndRalphInNewOrleans
* Skrien, Dale John. Object-oriented Design Using Java. Boston: McGraw-Hill Higher Education, 2009. Print
* http://en.wikipedia.org/wiki/Software_Ideas_Modeler
* http://findfiles.com/14090/details-quickcrc-macosx.html
* http://www.easycrc.com/
* http://alistair.cockburn.us/Using+CRC+cards
* http://en.wikipedia.org/wiki/Visual_Paradigm_for_UML
* http://www.visual-paradigm.com/product/vpuml/
* http://books.google.com/books/about/Using_CRC_Cards.html?id=baopCOstm_kC
* http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_5_as
* http://www.cc.gatech.edu/ectropic/papers :K. A. Gray, M. Guzdial, and S. Rugaber. Extending CRC cards into a complete design process. Technical report, College of Computing, Georgia Institute of Technology, Atlanta, GA, 2002.

Latest revision as of 03:26, 4 October 2012

Class-Responsibilty-Collaboration Cards

Class Responsibility Collaboration (CRC) cards are a brainstorming tool used in the design of object-oriented software. They were proposed by and Ward Cunningham and Kent Beck. They are typically used when first determining which classes are needed and how they will interact.


Introduction

CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.

A CRC-card corresponds to a class. A responsibility is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A collaborator is an object of another class "helping" to fulfill a specific responsibility.

The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.

The structure of a CRC-card is as shown below.

CRC cards are usually created from index cards on which there are written:

1. The class name

2. Its Super and Sub classes (if applicable)

3. The responsibilities of the class.

4. The names of other classes with which the class will collaborate to fulfill its responsibilities.

5. Author

Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.

A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.


CRC Models

A CRC model is a collection of CRC cards that represent whole or part of an application or problem domain. The most common use for CRC models is to gather and define the user requirements for an object-oriented application. The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table. Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.



Creating a CRC model

The CRC-card approach is especially well suited, when the problem is not well defined. During object-oriented analysis, the problem and the application domains are analysed to understand the problem at hand. The steps in creating a CRC model are as follows:

  • Find candidate classes by means of brainstorming
  • Filter the list of candidates
  • Create CRC-cards for the remaining candidates
  • Allocate responsibilities to CRC-cards/classes
  • Define scenarios to test/evaluate our model
  • Prepare the group session
  • "Role-play" scenarios using CRC-cards
  • Record scenarios and
  • Update CRC-cards and scenarios to reflect your findings (6.9).

These steps need not be performed in strict sequence. When filtering the list of candidates, usually all possible responsibilities should be considered in order to be able to make an informed decision. The last three steps are generally always performed in parallel.

Example of a CRC card

The CRC card for a class Book is as shown below:


A CRC card corresponds to a class. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.

A responsibility is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.

The collaborators indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.

Advantages of CRC cards

  • It’s simple and straightforward: You get a group of people together in a room and fill out a bunch of index cards. Because of its simplicity you can explain CRC modeling to a group of people in 10 or 15 minutes.
  • Language independent: This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)
  • Easy to test: Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.
  • Formal Analysis: CRC cards provide a basis for more formal analysis and design methodologies.
  • Life Cycle: CRC cards are useful throughout the life cycle.
  • Portable: CRC cards can be used anywhere, even away from the computer or office.
  • Increased user participation: Because users are actively involved in defining the model their satisfaction with the work will be much greater
  • Ease of transition: CRC cards eases the transition from process orientation to object orientation .
  • Prototyping: CRC modeling and prototyping are both iterative processes in which users are greatly involved. It is very common to draw rough sketches of screens and reports during CRC modeling sessions.
  • Class diagramming: CRC modeling leads directly into class diagramming. CRC models and class diagrams show many of the same concepts.

Disadvantages of CRC cards

  • It is threatening to some developers:Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.
  • It is hard to get users together: There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.
  • CRC cards are limited: CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.

CRC card tools

There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.

Stickies

One of the most simplest ways to produce CRC cards is by using applications like Stickies on Mac OSX and Sticky Notes on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.

Hot Draw

Hot Draw is a framework for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application.

Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.

As Hot Draw is a framework, an application needs to be built that actually utilizes it. One such application is JHotDraw, developed in part by Erich Gamma of "http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]" fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.

QuickCRC

Quick CRC is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.

Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.


Quick CRC Tool
Quick CRC Tool


QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.

QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.

Inheritance Graph
Inheritance Graph

A few popular features used in this tool are :

  • A set of existing cards pop up and we can add subclasses and superclasses to existing classes.
  • This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.
  • It can generate the inheritance graphs from the information on the CRC cards.
  • Linking cards and scenarios to foreign documents is made easy and thus they can be easily accessed with a single click of the mouse.
  • Information can be exported to other development tools as the CRC cards can be exported to MacA&D, WinA&D or QuickUML to auto-generate UML class diagrams.
  • It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.


Easy CRC

A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the Easy CRC tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system. The use of the Easy CRC tool is divided into two categories:

  • It helps in identifying the object, which are the CRC cards, from plain regular language.
  • It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.

Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.

There are two ways to update the responsibilities and collaborators in CRC diagram.

  • Firstly, Enter all the values manually.
  • Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.


Software Ideas Modeler

Software Ideas Modeler is a lightweight and powerful CASE CASE tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.

The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.

This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.

SWIdeasModeler Tool
SWIdeasModeler Tool

There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.Software Ideas Modeler - Wikipedia It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.

On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be "too much" information depending on one's opinion on the required elements of a CRC card.


Visual Paradigm for UML

A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.

Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.

Other than providing the common CRC-related functionalities, it has the following peculiarities:

  • Record audio to associate to a diagram.
  • Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)
  • Directly generating java code in eclipse with the class diagram.
  • All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)
  • It can generate UML class diagrams automatically out of the CRD cards.
  • Cannot drag and drop values from one card to the other.


Comparison and Trade Off between tools

Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:

Tools feature comparison
Feature QuickCRC VP UML SIM HD Stickies
Model scenarios
Drag values from card to card
Generate UML class diagrams
Handle subdiagrams
Generate Java code
Collapse/expand cards
Display/hide parts of a card
Export/import card diagrams to/from text files
Arrange cards based on different criteria
Analyze text to extract classes, responsibilities and attributes
Reverse engineer existing source code

Conclusion

CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design.

One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.

See Also

  1. MetaModeling
  2. CRC and Scenario
  3. Object Oriented Thinking
  4. Requirement Analysis

References