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

From Expertiza_Wiki
Jump to navigation Jump to search
(Created page with ""'''CRC Card Design Tools" '''Class-Responsibility-Collaborator Cards''' were initially proposed by [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck] and [http://en.wikipedia.o...")
 
 
(84 intermediate revisions by the same user not shown)
Line 1: Line 1:
"'''CRC Card Design Tools"
=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 [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-Collaborator Cards''' were initially proposed by [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck] and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] in 1989 "to document collaborative design decisions."<ref name="beck">[http://c2.com/doc/oopsla89/paper.html "A Laboratory For Teaching Object-Oriented Thinking"] by Beck and Cunningham</ref> They are a way to discover classes, determine the responsibilities of each of those classes, and describe their relationships. The information for each class is written on a separate card.<ref name="lecnotes">Lecture Notes</ref> This article will discuss CRC cards and how they have been implemented in several modern software packages.




Line 7: Line 6:


== Introduction ==
== Introduction ==
A CRC card is a notecard laid out in a particular fashion where one may define a [http://en.wikipedia.org/wiki/Class_(computer_programming) class], its responsibilities, and collaborators (see figures below). In this definition, a class refers to an [http://en.wikipedia.org/wiki/Object_(computer_science) object] in the traditional object-oriented sense; responsibilities refers to the actions that the object must take and roles it must fill; and collaborators refers to the other objects with which the originally defined class must interact.<ref name="skrien">Skrien, Dale John. Object-oriented Design Using Java. Boston: McGraw-Hill Higher Education, 2009. Print.</ref> In other words, the class name of an object "creates a vocabulary for discussing a design," the responsibilities "identify problems to be solved," and collaborators are "objects which will send or be sent messages in the source satisfying responsibilities."<ref name="beck"/> For a complete set of CRC card content of an ATM system, refer to this example: [http://www.math-cs.gordon.edu/local/courses/cs211/ATMExample/CRCCards.html CRC Cards for ATM Example].


{| style="margin: 1em auto 1em auto"
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.
|-
 
| [[File:CRCCardSample1.gif]] || [[File:CRCCardSample2.gif]]
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.
 
[[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:
 
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.
 
 
[[File:Crc_model.PNG|center|x300px]]
 
 
== 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:
 
[[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. 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.


Class-Responsibility-Collaborator cards are an evolution of simple [http://en.wikipedia.org/wiki/Use_case use cases]. In such use cases, "actors" would be defined and a "story" of their actions would be written. Extraction of the nouns and verbs in these stories would be leveraged in an effort to help determine the relevant classes and [http://en.wikipedia.org/wiki/Method_(computer_programming) methods].<ref name="skrien"/> The proponents of the method originally used 4"x6" index cards because they were "cheap, portable, readily available, and familiar."<ref name="beck"/> The process of designing a system via CRC cards starts with giving blank cards to the designing team. People in the team then start acting out the different use case scenarios. As the use cases are performed, classes and actions are written down and refined, ultimately resulting in a comprehensive class definition.
* '''Life Cycle''': CRC cards are useful throughout the life cycle.


* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.


This is how Beck and Cunningham describe the designing process, making the exception for specific details when needed<ref name="skrien"/>:
* '''Increased user participation''': Because users are actively involved in defining the model their satisfaction with the work will be much greater
<blockquote>We start with only one or two obvious cards and start playing "what-if". If the situation calls for a responsibility not already covered by one of the objects we either add the responsibility to one of the objects, or create a new object to address that responsibility. If one of the object becomes too cluttered during this process we copy the information on its card to a new card, searching for more concise and powerful ways of saying what the object does. If it is not possible to shrink the information further, but the object is still too complex, we create a new object to assume some of the responsibilities. The goal of this exercise is to encourage designers to pick up the card whose role they are assuming while 'executing' a scenario and stress the importance of creating objects not to meet mythical future needs, but only under the demands of the moment. This ensures that a design contains only as much information as the designer has directly experienced, and avoids premature complexity.<ref name="beck"/></blockquote>


* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .


The physical spacial arrangement of the cards can have informal meaning:
* '''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.
* When cards overlap it can mean that the objects represented by the cards are collaborating
* A card placed above another card can mean that the object it represents is supervising the object represented by the card below
* Cards representing parts are usually placed below the card representing the whole
* "Refinements of an abstraction can be collected and handled as a single pile of cards with the most abstract card on top where it can represent the rest"<ref name="beck"/>


* '''Class diagramming''': CRC modeling leads directly into class diagramming. CRC models and class diagrams show many of the same concepts.


Beck and Cunningham noticed that "when designers pick up a card they seem to more readily identify with it, and are prepared to deal with the remainder of the design from its perspective. It is the value of this physical interaction that ... resist[s] a computerization of the cards."<ref name="beck"/>
== 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.


This article will perform a survey of the computerization of this design methodology, keeping in mind that these tools may not provide the same user experience and ultimately the same design results as when the design team is interacting via the use of physical cards. The main criteria for successful execution of computerization will be how well the application can mimic the actions of using physical cards.
* '''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.


==Tools==
* '''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.
===Stickies===
Probably the simplest way to reproduce CRC cards on a computer is 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.


= 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.


{| style="margin: 1em auto 1em auto"
== Stickies ==
|+ '''Example of stickies'''
! ||
|-
| On Mac OSX|| On Windows 7
|-
| [[File:Stickies.png|x287px]] ||  [[File:Stickynotes.PNG|x287px]]
|}


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.


{| class="wikitable" style="margin: 1em auto 1em auto"
{|
|+ '''Mac OSX Stickies vs. Windows 7 Sticky Notes'''
|[[File:Stickies.png|x300px]]
! Feature || Mac OSX || Windows 7
|[[File:Stickynotes1.png|x300px]]
|- align="center"
| Change the background color of a note  || ✔ || ✔
|- align="center"
| Format text using different fonts and colors  || ✔ || ✔
|- align="center"
| Collapse and expand a note || ✔ ||
|- align="center"
| Insert images and videos into a note || ✔ ||
|- align="center"
| Make a note translucent || ✔ ||
|- align="center"
| Create a new note from the text selected in an application || ✔ ||
|- align="center"
| Import/export the content of a note || ✔ ||
|- align="center"
| Spell checker || ✔ ||
|- align="center"
| Add scrollbars to a note || ✔ || ✔
|- align="center"
| Support pen and touch input || ||
|}
|}


===QuickCRC===
== Hot Draw ==
[http://www.excelsoftware.com/quickcrcdownload.html QuickCRC] is a stand-alone application specifically designed to support CRC card diagrams.


[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"
{| style="margin: 1em auto 1em auto"
|+ '''Example of a CRC card and of a scenario'''
|+  
! ||  
! ||  
|-
|-
| Front of the CRC card|| Back of the CRC card|| Scenario
| [[File:JHotDraw.PNG|x287px]]
|-
| [[File:QuickCRCCardFront.png]] ||  [[File:QuickCRCCardBack.png]] || [[File:QuickCRCScenario.png]]
|}
|}
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 ==
'''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.
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]




"A scenario describes what happens in the system from a high-level, user’s point of view. The goal of walking through scenarios is to discover where additional classes,  
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.
responsibilities and collaborations are required or where existing items have become redundant."<ref name="qcrcpdf">QuickCRC Tutorial PDF</ref>


For example, the above scenario says that in order to write a document out to disk the UI (<tt>AnyClient</tt>) calls the <tt>Write</tt> responsibility of the <tt>TDocument</tt> object. Then the <tt>TDocument</tt> calls the <tt>EachItemDo</tt> responsibility of the <tt>TList</tt> object to loop through all the shapes contained in the document and finally the <tt>TDocument</tt> calls the <tt>Write</tt> responsibility of each <tt>TShape</tt> object. If a step in a scenario is particularly complex it can be modeled and detailed by a subscenario.
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.


One can walk through a scenario mentally or can use a tool that ''plays'' the scenario step by step. At each step the tool reports who is calling who and all the descriptions associated to the sender, receiver and responsibility called. This can help identifying missing or redundant pieces in the design (classes, responsibilities, attributes).
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]


In QuickCRC all the information in the cards can be dragged around into other cards and the tool takes care of establishing the appropriate relationship among the cards. For example if class <tt>TEventHandler</tt> is supposed to be the superclass of <tt>TWindow</tt>, one can drag the <tt>TEventHandler</tt> card name into the ''Superclasses:'' field of the <tt>TWindow</tt> card. Or if one needs to move a responsibility or an attribute from one class to another one can just drag the responsibility/attribute from the origin card to the recipient card. A class can inherit from multiple classes but the tool will not solve method name conflicts for the user.
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.


The tool can keep track of external agents like a user or other systems that typically drive or influence the functioning of the system being designed. If the system being designed is too large, the tool will allow the user to split the cards into multiple diagrams so that he or she can deal with only a manageable subset of cards at any time. The tool allows to arrange cards and scenarios based on different criteria, and the tool can generate graphs to show the inheritance structure of a card -- for example to show all the subclasses of a particular class.


Once the design reaches a point where implementation can start, the tool can generate a listing of all the classes in the system with relative attributes and responsibilities. This listing is then handed over to the programmers. The design can also be exported into a text file that can be imported by the QuickUML modeling tool. On the other hand the tool can import English text that describes the system one is trying to design and it will attempt to derive classes from nouns in the text, attributes from adjectives and responsibilities from verbs and it'll auto-generate cards accordingly.
== Easy CRC ==


If one is trying to reverse engineer existing source code, he or she can use tools like WinTranslator or MacTranslator to extract design information from the source code into a dictionary entries list that then can be imported into QuickCRC that will automatically populate a new project with cards that reflect the design information gathered by the other tools.
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.


===Visual Paradigm for UML===
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.
VP-UML is a [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool. It supports CRC card diagrams as part of the requirements management workflow. VP-UML provides tools to support many other workflows such as [http://en.wikipedia.org/wiki/Unified_Modeling_Language UML] modeling, business process modeling, database modeling, UI modeling, reverse engineering and more.


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.


{| style="margin: 1em auto 1em auto"
{|
|+ This is how CRC cards look in VP-UML:
|[[File:438px-EasyCRC2.png|x300px]]
! ||
|[[File:517px-EasyCRC1.png|x300px]]
|-
| [[File:VPCRC1.png]] || [[File:VPCRC2.png]]
|}
|}




The part of VP-UML that supports CRC card provides functionalities that are common to other tools but it has the following peculiarities:
== Software Ideas Modeler ==
* It can generate UML class diagrams automatically out of the CRD cards.
 
* A class diagram can also generate Java code for the classes directly inside Eclipse
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.
* 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 [http://www.visual-paradigm.com/support/documents/vpumluserguide/1281/1289/6518_drawingcrcca.html here])
 
* Cannot drag and drop values from one card to the other.
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.
* You can record audio to associate to a diagram.
* You can decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)


===Software Ideas Modeler===
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.
[http://www.softwareideas.net/ Software Ideas Modeler] is a "lightweight and powerful [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool" by Dušan Rodina. It can be used to create UML diagrams, manage tasks, reverse engineer, generate source code, and help to create other diagram types (including CRC cards). Below is an exported graphic of the software's capabilities in regards to working with CRC cards.


{| style="margin: 1em auto 1em auto"
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]
|+
! ||
|-
| [[File:SWIdeasModeler.png|x287px]]
|}


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.
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.


One nice feature of SIM was the ability to attach "comment cards" to any item. This feature is the equivalent of adding a "Post-It" note to a card that contains any additional information about the items on the card. The software also has the ability to arrange the cards in a variety of different ways. Not only can cards be stacked, but they can be arranged in row, circle, cascade, and smart (grouped and routed by object type). Groups and even separate layers can be made to further enhance this arrangement functionality. Software Ideas Modeler additionally has the ability to export documentation sets into PDF format automatically.


===Hot Draw===
== Visual Paradigm for UML ==


[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). Toward that end, Hot Draw is not exactly a CRC card creation application but instead could be thought of the genesis for CRC card design in the first place.<ref name="neworleans">[http://c2.com/cgi/wiki?WardAndRalphInNewOrleans Ward and Ralph in New Orleans]</ref>
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.


{| style="margin: 1em auto 1em auto"
{|
|+
|[[File:File-Crc-visual.png|x300px]]
! ||
|[[File:File-Edit description.png|x300px]]
|-
| [[File:JHotDraw.PNG|x287px]]
|}
|}


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.


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. 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 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.


==Conclusion==
= Comparison and Trade Off between tools =
All the tools that we analyzed in this article were able to simulate the basic usage of physical CRC cards; their core functionality is highlighted in the table below. They provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Many tools also provide additional features often related to the context they work in. For example, some of these tools are part of larger CASE systems or suites and therefore they expose functionalities to interact with other tools of the suite. All the tools we tested were pretty easy to use and understand. In the table below, the features that the different tools provide are contrasted. However, one aspect that none of the tools can replicate is the human interaction of people playing scenarios with real CRC cards. This interaction is difficult to replicate with computer programs and is the main limitation as mentioned at the beginning of the article.


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"
{| class="wikitable" style="margin: 1em auto 1em auto"
Line 187: Line 247:
|}
|}


= Conclusion =


Overall, CRC cards came about in the 90s when computer scientists Beck and Cunningham felt that "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."<ref name="beck"/> In the present day, there are new kinds of user interfaces and programming environments that could be used to retain the value of physical interaction. For example, a mobile application could be implemented that allows people to play CRC cards on their smartphones or tablets as they were playing with real cards. With the addition of live video/audio connections those people could also physically be in different places while playing the scenarios together. However, no solution that implements this functionality is currently known.
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.  


==See also==
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://www.runrev.com/home/ Revolution]
* [http://pythoncard.sourceforge.net/ PythonCard]
* [http://pythoncard.sourceforge.net/ PythonCard]
Line 198: Line 260:
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard 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://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==
= References =
<references/>
 
==Further Reading==
 
* [http://www.informit.com/articles/article.aspx?p=1391208&seqNum=1 CRC Cards: An Agile Thinking Tool]
* [http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card CRC cards on Wikipedia]
* [http://www.macosxtips.co.uk/index_files/10-tips-for-stickies.php Stickies on Mac]
* [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes on Windows 7]
 
==External Links==


* [http://www.visual-paradigm.com/solution/freeumltool/?src=google&kw=UML&mt=b&net=g&plc=&gclid=COLtxZ3w4asCFYEj7Aod7g1iNA Visual Paradigm for UML]
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa
* [http://www.excelsoftware.com/quickcrcdownload.html QuickCRC]
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd
* [http://www.softwareideas.net/en/Default.aspx Software Ideas Modeler]
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js
* [http://st-www.cs.illinois.edu/users/brant/HotDraw/HotDraw.html Hot Draw], implemented as [http://www.jhotdraw.org/ JHotDraw]
* http://www.excelsoftware.com/quickcrcintro
* [http://sourceforge.net/projects/crccardeditor/ CRC Card Editor] ''unfinished CRC card editing tool''
* 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