CSC/ECE 517 Fall 2011/ch4 4i aa: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(32 intermediate revisions by 2 users not shown)
Line 1: Line 1:
"'''CRC Card Design Tools"
"'''CRC Card Design Tools"


'''Class-Responsibility-Collaborator Cards''' were initially proposed by Kent Beck and 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.
'''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 7:


== Introduction ==
== Introduction ==
A CRC card is a notecard laid out in a particular fashion where one may define a class, its responsibilities, and collaborators (see figures below). In this definition, a class refers to an object in the traditional object-oriented sense; responsibilities refers to the actions that the object must take; 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].
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"
|+
! ||
|-
| [[File:CRCCardSample1.gif]] || [[File:CRCCardSample2.gif]]
|}


[[File:CRCCardSample1.gif]] [[File:CRCCardSample2.gif]]




Class-Responsibility-Collaborator cards are an evolution of simple 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 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.
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.




Line 21: Line 27:


The physical spacial arrangement of the cards can have informal meaning:
The physical spacial arrangement of the cards can have informal meaning:
*When cards overlap it can mean that the objects represented by the cards are collaborating
* 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
* 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
* 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"/>
* "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"/>
 


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"/>


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


==Tools==
==Tools==
===Stickies===
===Stickies===
Probably the simplest way to reproduce CRC cards on a computer is using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] onMac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7.
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.


On Mac OSX a Sticky looks like


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


Stickies can hold all the information that physical CRC cards contain.


{| class="wikitable" style="margin: 1em auto 1em auto"
{| class="wikitable" style="margin: 1em auto 1em auto"
Line 65: Line 78:


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




{|  
{| style="margin: 1em auto 1em auto"
|+ Example of a CRC card and of a scenario
|+ '''Example of a CRC card and of a scenario'''
! ||  
! ||  
|-
|-
Line 81: Line 94:
responsibilities and collaborations are required or where existing items have become redundant."<ref name="qcrcpdf">QuickCRC Tutorial PDF</ref>
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.
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.


If a step in a scenario is particularly complex it can be modeled and detailed by a subscenario.
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).


You can walk through a scenario mentally or you can use a tool that ''plays'' the scenario step by step. At each step the tool reports who's 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).
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.


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> you can drag the <tt>TEventHandler</tt> card name into the ''Superclasses:'' field of the <tt>TWindow</tt> card. Or if you need to move a responsibility or an attribute from one class to another you can just drag the responsibility/attribute from the origin card to the recipient card. A class can inherit from multiple classes but the tool won't solve method name conflicts for you.
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.


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


If the system to design is large, the tool will allow you to split the cards into multiple diagrams so that you can deal with only a manageable subset of cards at any time.
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.


The tool allows to arrange cards and scenarios based on different criteria.
===Visual Paradigm for UML===
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.


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.
{| style="margin: 1em auto 1em auto"
|+ This is how CRC cards look in VP-UML:
! ||
|-
| [[File:VPCRC1.png]] || [[File:VPCRC2.png]]
|}


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 you are 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.
If you are trying to reverse engineer existing source code, you 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.
===Visual Paradigm for UML===
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 UML modeling, business process modeling, database modeling, UI modeling, reverse engineering and more.
This is how CRC cards look in VP-UML:
[[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:
The part of VP-UML that supports CRC card provides functionalities that are common to other tools but it has the following peculiarities:
*It can generate UML class diagrams automatically out of the CRD cards.
* 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
* A class diagram can also generate Java code for the classes directly inside Eclipse
*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])
* 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.
* Cannot drag and drop values from one card to the other.
*You can record audio to associate to a diagram.
* You can record audio to associate to a diagram.
*You can decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)
* You can decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)


===Software Ideas Modeler===
===Software Ideas Modeler===
[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.
[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:SWIdeasModeler.png|x287px]]
|+
! ||
|-
| [[File:SWIdeasModeler.png|x287px]]
|}




Line 135: Line 146:
[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>  
[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>  


[[File:JHotDraw.PNG|x287px]]
{| style="margin: 1em auto 1em auto"
|+
! ||
|-
| [[File:JHotDraw.PNG|x287px]]
|}
 


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.
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==
==Conclusion==
"Because the designs are so much more concrete, and the logical relationship between objects explicit, it is easier to understand, evaluate, and modify a design.
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.
 
We were surprised at the value of physically moving the cards around. When learners pick up an object 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 has led us to resist a computerization of the cards.


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." [1 Beck/Cunningham]


{| class="wikitable" style="margin: 1em auto 1em auto"
{| class="wikitable" style="margin: 1em auto 1em auto"
Line 164: Line 178:
| Display/hide parts of a card ||  || ✔ || ||  ||
| Display/hide parts of a card ||  || ✔ || ||  ||
|- align="center"
|- align="center"
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ ||  
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||
|- align="center"
|- align="center"
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔
Line 173: Line 187:
|}
|}


==See also==


More a programming tool than design [5] [http://c2.com/cgi/wiki?HyperCard HyperCard]
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.


More a programming tool than design [6] [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]
==See also==
 
More a programming tool than design [7] [http://www.supercard.us/supercard/index.html SuperCard]
 
Acquisition made this obsolete it seems [8] [http://www.metacard.com/ MetaCard]
 
Acquisition made this obsolete it seems [9] [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]
 
More a programming tool than design [10] [http://www.runrev.com/home/ Revolution]
 
More a programming tool than design [11] [http://pythoncard.sourceforge.net/ PhytonCard]
 
More a programming tool than design [12] [http://freecard.sourceforge.net/website/ FreeCard]
 
More a programming tool than design [13] [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]


* [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]


==References==
==References==
<references/>
<references/>


==Further Reading==
==Further Reading==


[2] [http://www.informit.com/articles/article.aspx?p=1391208&seqNum=1 CRC Cards: An Agile Thinking Tool]
* [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]
[3] [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]
Aldo [18] [http://www.macosxtips.co.uk/index_files/10-tips-for-stickies.php Stickies on Mac]
 
Andy will evaluate [19] [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes on Windows 7]
 


==External Links==
==External Links==


Aldo [14] [http://www.visual-paradigm.com/solution/freeumltool/?src=google&kw=UML&mt=b&net=g&plc=&gclid=COLtxZ3w4asCFYEj7Aod7g1iNA Visual Paradigm for UML]
* [http://www.visual-paradigm.com/solution/freeumltool/?src=google&kw=UML&mt=b&net=g&plc=&gclid=COLtxZ3w4asCFYEj7Aod7g1iNA Visual Paradigm for UML]
 
* [http://www.excelsoftware.com/quickcrcdownload.html QuickCRC]
Aldo [15] [http://www.excelsoftware.com/quickcrcdownload.html QuickCRC]
* [http://www.softwareideas.net/en/Default.aspx Software Ideas Modeler]
 
* [http://st-www.cs.illinois.edu/users/brant/HotDraw/HotDraw.html Hot Draw], implemented as [http://www.jhotdraw.org/ JHotDraw]
Andy will evaluate [16] [http://www.softwareideas.net/en/Default.aspx Software Ideas Modeler]
* [http://sourceforge.net/projects/crccardeditor/ CRC Card Editor] ''unfinished CRC card editing tool''
 
Andy will evaluate [4] [http://st-www.cs.illinois.edu/users/brant/HotDraw/HotDraw.html Hot Draw], implemented as JHotDraw [http://www.jhotdraw.org/]
 
Andy will evaluate [17] [http://sourceforge.net/projects/crccardeditor/ CRC Card Editor] < Cannot evaluate due to incomplete build scripts and no documentation.

Latest revision as of 04:07, 20 October 2011

"CRC Card Design Tools"

Class-Responsibility-Collaborator Cards were initially proposed by Kent Beck and Ward Cunningham in 1989 "to document collaborative design decisions."<ref name="beck">"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.


Introduction

A CRC card is a notecard laid out in a particular fashion where one may define a class, its responsibilities, and collaborators (see figures below). In this definition, a class refers to an 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: CRC Cards for ATM Example.



Class-Responsibility-Collaborator cards are an evolution of simple 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 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.


This is how Beck and Cunningham describe the designing process, making the exception for specific details when needed<ref name="skrien"/>:

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"/>


The physical spacial arrangement of the cards can have informal meaning:

  • 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"/>


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"/>

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.

Tools

Stickies

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


Example of stickies
On Mac OSX On Windows 7


Mac OSX Stickies vs. Windows 7 Sticky Notes
Feature Mac OSX Windows 7
Change the background color of a note
Format text using different fonts and colors
Collapse and expand a note
Insert images and videos into a note
Make a note translucent
Create a new note from the text selected in an application
Import/export the content of a note
Spell checker
Add scrollbars to a note
Support pen and touch input

QuickCRC

QuickCRC is a stand-alone application specifically designed to support CRC card diagrams.


Example of a CRC card and of a scenario
Front of the CRC card Back of the CRC card Scenario


"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, 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 (AnyClient) calls the Write responsibility of the TDocument object. Then the TDocument calls the EachItemDo responsibility of the TList object to loop through all the shapes contained in the document and finally the TDocument calls the Write responsibility of each TShape object. If a step in a scenario is particularly complex it can be modeled and detailed by a subscenario.

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

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 TEventHandler is supposed to be the superclass of TWindow, one can drag the TEventHandler card name into the Superclasses: field of the TWindow 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.

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.

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.

Visual Paradigm for UML

VP-UML is a 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 UML modeling, business process modeling, database modeling, UI modeling, reverse engineering and more.


This is how CRC cards look in VP-UML:


The part of VP-UML that supports CRC card provides functionalities that are common to other tools but it has the following peculiarities:

  • 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
  • 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)
  • Cannot drag and drop values from one card to the other.
  • 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

Software Ideas Modeler is a "lightweight and powerful 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.


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

Hot Draw is a 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">Ward and Ralph in New Orleans</ref>


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

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.


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


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.

See also

References

<references/>

Further Reading

External Links