CSC/ECE 517 Spring 2013/ch4b 1l dh: Difference between revisions
Line 6: | Line 6: | ||
__TOC__ | __TOC__ | ||
== Introduction <ref> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa </ref> == | == Introduction <ref> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa </ref> <ref> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa </ref> == | ||
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]. | 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]. | ||
Revision as of 01:24, 20 February 2013
CRC <ref> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa </ref>
Class-Responsibility-Collaborator Cards (CRC) are an 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> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa </ref> <ref> http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa </ref>
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.
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"/>
Steps in making CRC Cards <ref>http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd#Steps_in_making_CRC_Cards</ref>
- 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 Arrangment
- 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
There are a couple of CRC card tools available which are implemented in software packages to help users manage the different stories.
Stickies
Stickies is a simplistic method to mimic physical CRC cards with software. It is available for Microsoft Windows 7 and Windows 8. Sticky Notes.
- 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 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.<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. 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.
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 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. Very useful features of Software Ideas Modeler can be automatic scrolling, symbolic editing of elements or automatic size adjustment of the elements. The tool 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>
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. 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
One of the less popular tool is the Easy CRC tool which 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. The tool provides an option of flipping the card to mention the attributes, description and any comments for that class. The tool is fairly simple to use and 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, like as a single card, showing all cards in a window, in a browser window, cards grouped by sub systems, etc. These views are highly connected and thus easily navigable. It can also help generate hierarchy graphs for any class. The tool is fairly simple to use and intuitive.
Conclusion
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.
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 of software based CRC creation.
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 | ✔ | ✔ | ✔ |
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/>
External Links
- Visual Paradigm for UML
- QuickCRC
- Software Ideas Modeler
- CRC Card Editor unfinished CRC card editing tool