CSC/ECE 517 Spring 2013/ch4b 1l dh
CRC <ref name="aa"> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa </ref>
Class-Responsibility-Collaborator Cards (CRC) are a design and organization technique used to help discuss and outline object-oriented software. It was 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> This technique is a way to outline classes, determine their responsibilities, and describe their relationships. CRC cards can be either physical (such as on index cards), or digital. In either case the information for each class is written/displayed on separate cards.<ref name="lecnotes">Lecture Notes</ref>
Introduction <ref name="aa"/> <ref name="sd"> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd </ref>
A CRC card is commonly a notecard laid out in a particular fashion where one may define a class, its responsibilities, and collaborators (see figures below). 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> 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.
Generic Template
Class name | |
---|---|
Responsibilities | Collaborators |
- Example
- Background
Class-Responsibility-Collaborator cards are an evolution of use cases. Use cases would use "actors" and then define a "story" of their actions. The nouns and verbs in these stories would be leveraged in an effort to help determine the relevant classes and methods.<ref name="skrien"/> This method originally used 4"x6" index cards because they were "cheap, portable, readily available, and familiar."<ref name="beck"/>
Creating CRC Cards <ref name="sd"/>
- Identify and assign candidate classes
- Determine a set of specific scenarios
- Walk through the scenario, naming cards and responsibilities
- Write the main responsibility for each class
- Identify the responsibilities for each class
- Identify one or more collaborators for each class
These index cards become your class diagram. In your class diagram, you create a class for each card that was used. The responsibilities on the card become the method of the class. All collaborators indicate that an association between the two classes must be drawn (and the class will need to have an instance of the collaborating classes). Finally, the data members on the back of the card become the attributes of the class.
Beck and Cunningham describe the designing process:<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"/>
- Physical Arrangement
- 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"/>
Tools <ref name="aa"/><ref name="sd"/><ref name="js"> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js </ref>
There are several CRC card tools available which are implemented in software. They help ease the creation of CRC cards when many are necessary or a digital format is preferred. A digital representation is easier to share, and modify in large numbers.
Stickies
Sticky Notes is a simplistic method to mimic physical CRC cards with software. It is available for Microsoft Windows 7 and Windows 8.
- On Windows 7
QuickCRC
QuickCRC is a tool developed by Excel Software for responsibility driven design of object-oriented software using CRC cards. CRC cards are used to discover and document classes, responsibilities, attributes and collaborations between classes. Design scenarios can be identified and simulated. Complex designs can be partitioned into multiple diagrams with easy navigation through a contents view. The inheritance graph automatically shows the class structure of the evolving design. The user can assign the attribute access of each card responsibility and the tool presents an attribute access graph.<ref name="quickcrc1">QuickCRC Tool</ref> This tool is available for both Windows and Mac OS X.
The features of QuickCRC<ref name="quickcrc2">QuickCRC by Excel Software</ref> are:
- Cards and scenario objects can be drawn in the diagram workspace. Each card has a class name, description, superclasses, subclasses, attributes, responsibilities and collaborating objects.
- The card information is entered through a dialog or edit on-screen by dragging or renaming cards, attributes, responsibilities and collaborations.
- Assign the attribute access of each card responsibility. Also shows an attribute access graph from the card information to help developers discover, refine and eliminate unnecessary card attributes.
- Scenarios can reference cards or other scenarios.
- Cut and paste cards and scenarios between diagrams or projects.
- Allows a designer to navigate between diagrams shown as folder icons that can be opened or closed. A card or scenario can be dragged between diagrams or double-clicked to edit its properties making it easy to locate and modify information as the model grows.
- Provides active simulation of an evolving design.
- Maintains relationships between cards, scenarios and external agents as fluid design changes take place. If a card references undefined subclasses or superclasses, those cards are generated automatically.
- Model other relationships between cards like aggregation and interface implementation.
- Name changes and cross references between objects are instantly updated.
- Has a rich search feature for locating design data within specific fields of any card or scenario in the project.
This software tool runs best on Windows XP, Vista or 7 with 1 GB RAM. The package includes both a Standard and Lite edition. The only difference between these two editions is the amount of data that a project can hold and the memory requirements of your machine.<ref name="quickcrc2" />
Software Ideas Modeler
Software Ideas Modeler is a lightweight and powerful CASE tool. It supports UML 2.2 diagrams. Software Ideas Modeler is freeware. <ref name="modeler">Software Ideas Modeler</ref>
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. It supports standard functions such as as undo/redo and copy paste with the 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. An interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments.
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.<ref name="simwiki">Software Ideas Modeler - Wikipedia</ref> It also provides support for various languages. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG. It has support for source code generation for languages like C#, VB.NET, SQL DDL.
Visual Paradigm
Visual Paradigm for UML (VP-UML) is a UML CASE Tool supporting UML 2, SysML and Business Process Modeling Notation (BPMN) from the Object Management Group (OMG). In addition to modeling support, it provides report generation and code engineering capabilities including code generation. It can reverse engineer diagrams from code, and provide round-trip engineering for various programming languages.<ref name="visual">Visual Paradigm for UML</ref>
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. It allows easy addition of responsibilities to a class. Along with this, all fields on a CRC card can be edited inline. The CRC diagrams in the tool are not linked to the sequence diagrams. This tool can be integrated with Eclipse/IBM WebSphere, Borland, JBuilder, NetBeans IDE, IntelliJ IDEA, Oracle JDeveloper and BEA WebLogic Workshop to support the implementation phase of software development. The transitions from analysis to design and then to implementation are seamlessly integrated within the CASE tool, thus significantly reducing efforts in all stages of the software development lifecycle.<ref name="tools">Visual Paradigm</ref>
CRC Design Assistant
The CRC Design Assistant was first conceived to assist students in creating real-world software applications in the context of the software engineering course at UTEP. This tool helps in visualizing the design, tracking design changes, maintaining the list of system responsibilities when classes are removed, revising documentation when designs change, and presenting a design to other team members and observers.<ref name="design">Steve Roach, Department of Computer Science, University of Texas at El Paso, Javier C Vásquez, Department of Computer Science, University of Texas at El Paso, "A Tool to Support the CRC Design Method", October 2004</ref>
The characteristics of this tool are:
- Supports the CRC design method and assist students in creating, modifying, and documenting
- Helps in creating object-oriented designs
- Helps maintain a class hierarchy of the different classes (cards) that are created for a subsystem
- Provides a drag and drop feature where the responsibilities could be selected and dragged in the subsystem or class list
- Draws lines to indicate collaborator classes making it visually easy to understand and correlate
- Supports a team environment and is accessible over the internet
- Allows the ability to track changes made by each team member
- Generates a design documentation in the form of RTF files and diagrams
- Stores the entire design in a single database
The tool is fairly simple and easy to maintain.
EasyCRC Tool
The Easy CRC tool makes use of the .NET Framework. This tool divides the task of making CRC cards into two stages. The first stage is identifying the objects from a definition which is a plain text and then identifying the responsibilities and collaborators for the identified responsibilities by simulating scenarios through sequence diagrams.<ref name="easy">EasyCRC Tool</ref>
Editing the CRC cards using the CRC card editor can be done in different ways. One method is to enter all information manually - editing the different values through the property editor in the tool. Right-click the “CRC cards” node in the solution explorer; a sub menu will be displayed with an option to add an item to the sub tree below. In this manner the user can Assign Responsibilities, Add Attributes, Add Methods to responsibilities and set the different properties of the item. Another way is to create sequence diagrams and from them, the collaborators and responsibilities of the CRC cards would be discovered automatically.<ref name="easypaper">"Easy CRC Tool - Description Paper"</ref> This tool also has an option to export the data to the XMI format so it can be imported to visual paradigm and other tools.
Rose CRC
Rose CRC<ref name="rosecrc">Wilkinson, N. Using CRC Cards, "An Informal Approach to Object-Oriented Development," SIGS, New York, 1995.</ref> is a tool that supports CRC card processes at various levels. This tool is used to record responsibilities of classes, their collaborators, and also maintain superclass/subclass relationships. It provides an option of flipping the card to mention the attributes, description and any comments for that class. It also provides an option of selecting from existing classes and their responsibilities, collaborators and superclass/subclass relationships by a drop down menu. A detailed view of responsibilities can be provided in a separate window.
The tool provides an option of viewing the cards in various ways, such as single card, all cards, in a browser window, and grouped by sub systems. These views are connected and thus easily navigable. Hierarchy graphs are possible for any class.
Conclusion <ref name="aa"/> <ref name="sd"/>
CRC cards are used to give a useful and convincing experience with objects and the mechanisms of objects but do not yet see their value. Using CRC cards, one can speculate the 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 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.
Feature | QuickCRC | Visual Paradigm | Software Ideas Modeler | CRC Design Assistant | Stickies | EasyCRC Tool | Rose CRC |
---|---|---|---|---|---|---|---|
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 | ✔ | ✔ | ✔ |
In the table above, 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 of software based CRC creation.
Pros / Cons of CRC Cards<ref name="sd"/>
Advantages
- The experts do the analysis: The people who understand the problem domain, the business domain experts (BDEs) are the people who create the model.<ref name="advantages">Scott W. Ambler (November 29, 1998), "CRC Modeling: Bridging the Communication Gap Between Developers and Users", An AmbySoft Inc. White Paper</ref>
- User participation increased: Users are actively involved in defining the model and thus increases their participation in understanding the system and creating it.
- Breaks down communication barriers: Users and developers work togther side-by-side to create the CRC model.<ref name="advantages" />
- Simple and Straightforward: CRC cards are easy to fill out and provide the essence of the system in a simple and straightforward manner.
- 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.<ref name="advantages" />
- Transition: CRC cards eases the transition from process orientation to object orientation.
Disadvantages
- Inefficient for larger systems: For a larger system, there are many classes and maintaining all of them becomes difficult especially if there are many dependencies. Hence, CRC cards tend to prove inefficient and time consuming while modelling larger systems.
- Limited Details: CRC cards provide limited details about the software elicitation because of the high level abstraction.<ref name="disadvantages">Mr. Sham-Ul-Arif, Mr. Qadeem Khan, S. A. K. Gahyyur, "Requirements Engineering Processes, Tools/Technologies, & Methodologies, International Journal of Reviews in Computing, ISSN: 2076‐3328 http://www.ijric.org/volumes/Vol2/6Vol2.pdf</ref>
- Hard to get users together: To schedule people for CRC modelling is difficult.
- Time consuming: Creating many cards manually can be a time consuming process.
See also
- Unified Modeling Language
- Responsibility-driven Design
- Object-Oriented Design
- ECE/CSC 517 Fall 2011 (aa)
- ECE/CSC 517 Fall 2011 (sd)
- ECE/CSC 517 Fall 2011 (js)
References
<references/>