CSC/ECE 517 Fall 2010/ch1 2b dg: Difference between revisions
No edit summary |
Dragon9786 (talk | contribs) No edit summary |
||
(12 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
===A CRC Example=== | ===A CRC Example=== | ||
To better understand how the CRC cards work together, let us consider an | To better understand how the CRC cards work together, let us consider a simple student enrollment problem,where we are required to model the students enrolled in different courses. We can easily define the <b>Student CRC Card</b> as having attributes such as student name, student id and responsibilities that enable a student to enroll in a course or drop the course. In this particular instance, the collaborating class would be the <b>Course</b> class. The <b>Course CRC Card</b> can in turn be visualized as having its own responsibilities, such as having attributes like Course Id, course name and the collaborating class would be the <b>Instructor | ||
class</b>. The CRC cards for the Student class and the Course Class are shown below.<br><br> | |||
[[Image:Stud_enr_Crc.jpg|frame|center|Student and Course CRC Card]] | |||
<br> | |||
There are also several practical designs that use the CRC card model to design Object oriented software design. The [http://www.extremeprogramming.org/example/crcsim.html Simulator for Coffee Maker] explores an [http://en.wikipedia.org/wiki/Extreme_Programming Extreme Programming] approach combined with CRC card technique to come up with a design for the coffee maker. | |||
Another interesting approach using CRC cards explores a design for the [http://www.math-cs.gordon.edu/courses/cps211/ATMExample/CRCCards.html ATM Machine] | |||
===Advantages of CRC cards=== | ===Advantages of CRC cards=== | ||
There are quite a few advantages of CRC cards that make it a preferable model in many designs. Some of the advantages of the CRC card design method are | |||
<br> | |||
:* CRC cards can allow designers to easily make audience understand a very complex system. In essence it allows for building more complex designs by slowly building the interactions between the collaborating classes, one by one. | |||
:* CRC cards are a simple technique and it can be easily used by anyone with very little training and does not require any expensive computing resources(a board or a paper and a pen would suffice). | |||
:* CRC is fundamentally a brainstorming tool, enabling different people in a team to come up with the design by collaborating, enabling everyone in the team to contribute | |||
:* CRC can be used with other formal object oriented design methodologies such as [http://en.wikipedia.org/wiki/Extreme_Programming Extreme Programming] (an [http://en.wikipedia.org/wiki/Agile_Modeling Agile] development Technique) and can be used along with modelling languages such as [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language(UML)] | |||
==Why need a Software for CRC Cards== | ==Why need a Software for CRC Cards== | ||
CRC cards are limited by their scope. If we go about designing a huge project, the scope spans many classes and interactions between them. The tedious task of maintaining are CRC cards and to properly formulate interaction can get overwhelming. | CRC cards are limited by their scope. If we go about designing a huge project, the scope spans many classes and interactions between them. The tedious task of maintaining are CRC cards and to properly formulate interaction can get overwhelming. | ||
Following reasons propel use for software for CRC Cards : | Following reasons propel use for software for CRC Cards : | ||
:* Designing Scenario: A scenario represents series of steps in which classes and objects communicate. There are be references to other cards or scenarios. | :* <b>Designing Scenario:</b> A scenario represents series of steps in which classes and objects communicate. There are be references to other cards or scenarios. | ||
:* Modeling : Software provide an easy way to segregate cards and objects into different diagrams. Thus we can model our software with different functionality very easily. | :* <b>Modeling :</b> Software provide an easy way to segregate cards and objects into different diagrams. Thus we can model our software with different functionality very easily. | ||
:* Simulation : Software can provides simulation of an software design. This might include single stepping backwards, forwards a scenario or jumping to a specific location in the scenario stack of a multiple scenario simulation | :* <b>Simulation :</b> Software can provides simulation of an software design. This might include single stepping backwards, forwards a scenario or jumping to a specific location in the scenario stack of a multiple scenario simulation | ||
:* Synchronization and Dependencies: Software can maintain relationships between cards, scenarios as design changes take place. If a card references other cards or classes, those cards are generated automatically. Also any name changes and cross references between objects are instantly updated. | :* <b>Synchronization and Dependencies:</b> Software can maintain relationships between cards, scenarios as design changes take place. If a card references other cards or classes, those cards are generated automatically. Also any name changes and cross references between objects are instantly updated. | ||
:* Revision history and Version Control : Software for CRC cards supports changes to CRC cards. It is easy to model and keep track of all changes to a CRC cards. This is extremely helpful in realizing the design changes to CRC cards. | :* <b>Revision history and Version Control :</b> Software for CRC cards supports changes to CRC cards. It is easy to model and keep track of all changes to a CRC cards. This is extremely helpful in realizing the design changes to CRC cards. | ||
==Desining Software== | ==Desining Software== | ||
The following steps proceed while designing Software for CRC cards: | The following steps proceed while designing Software for CRC cards: | ||
<b> | *<b>Create CRC Cards</b> | ||
A CRC model is usually created by an individual or small group of designers during the early phase of an object-oriented development project.The figure shows the design of hierarchy of classes. These set of class used for drawing objects are shown. We can see TShape class has a superclass called TObject and two subclasses, TBox and TCircle. Lets assume we create new class TWindow derived from the superclass TObject. [[Image:Design.png|thumb|Description]] | A CRC model is usually created by an individual or small group of designers during the early phase of an object-oriented development project.The figure shows the design of hierarchy of classes. These set of class used for drawing objects are shown. We can see TShape class has a superclass called TObject and two subclasses, TBox and TCircle. Lets assume we create new class TWindow derived from the superclass TObject. [[Image:Design.png|thumb|Description]] | ||
<b> | *<b>Assign Responsibilities</b> | ||
Once a set of classes are defined, behaviors can be assigned that will provide the functions of the application. For example, the TShape card has responsibilities Initialize to create it and Draw to illustrate it on the diagram. | Once a set of classes are defined, behaviors can be assigned that will provide the functions of the application. For example, the TShape card has responsibilities Initialize to create it and Draw to illustrate it on the diagram. | ||
<b> | *<b>Add Attributes</b> | ||
Attributes of classes may also be identified in a CRC Card.The TShape class has attributes fPosition, fType and | Attributes of classes may also be identified in a CRC Card.The TShape class has attributes fPosition, fType and | ||
fSelected. | fSelected. | ||
<b> | *<b>Define and simulate Scenario</b> | ||
A scenario describes a sequence of steps in the design using the responsibilities of a group of collaborating | A scenario describes a sequence of steps in the design using the responsibilities of a group of collaborating | ||
Line 54: | Line 66: | ||
By single stepping forwards, backwards or through each subscenario, bugs in the design can be identified and corrected early. | By single stepping forwards, backwards or through each subscenario, bugs in the design can be identified and corrected early. | ||
<b> | *<b>Partition the Design</b> | ||
As the number of CRC cards in the design grows, they can be grouped by function. Using Software for CRC cards, | As the number of CRC cards in the design grows, they can be grouped by function. Using Software for CRC cards, | ||
separate diagrams are used to partition the model into different subject areas. | separate diagrams are used to partition the model into different subject areas. | ||
<b> | *<b>Inheritance Graph</b> | ||
An automated tool can generate an inheritance graph from information on CRC cards. This diagram can | An automated tool can generate an inheritance graph from information on CRC cards. This diagram can | ||
concisely illustrate the big picture of a large project that might contain hundreds of classes and dozens of diagrams. | concisely illustrate the big picture of a large project that might contain hundreds of classes and dozens of diagrams. | ||
<b> | *<b>Verify Your Work </b> | ||
Creating and simulating scenarios will help verify that a design is correct and complete. A CRC software | Creating and simulating scenarios will help verify that a design is correct and complete. A CRC software | ||
Line 70: | Line 82: | ||
may not be needed. | may not be needed. | ||
==Summary== | |||
Software for CRC cards are immensely helpful in designing and modeling Software development using CRC cards.As the size of object-oriented system grow, it becomes increasingly difficult to model the problem with index based CRC cards. Thus an automated tool is required to maintain design and clear functionality. | Software for CRC cards are immensely helpful in designing and modeling Software development using CRC cards.As the size of object-oriented system grow, it becomes increasingly difficult to model the problem with index based CRC cards. Thus an automated tool is required to maintain design and clear functionality. | ||
==See Also== | |||
*[http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language(UML)] | |||
*[http://en.wikipedia.org/wiki/Agile_Modeling Agile Modelling] | |||
*[http://en.wikipedia.org/wiki/Extreme_Programming Extreme Programming] | |||
==References== | ==References== | ||
Line 82: | Line 95: | ||
[2] CRC Cards: [http://www.extremeprogramming.org/rules/crccards.html http://www.extremeprogramming.org/rules/crccards.html] | [2] CRC Cards: [http://www.extremeprogramming.org/rules/crccards.html http://www.extremeprogramming.org/rules/crccards.html] | ||
[3] [http://www.extremeprogramming.org/example/crcsim.html A Simulator for Coffee Maker] | |||
[4] [http://www.math-cs.gordon.edu/courses/cps211/ATMExample/CRCCards.html CRC Card for ATM] | |||
==External Links== | ==External Links== | ||
* [http://c2.com/doc/oopsla89/paper.html A Laboratory For Teaching Object-Oriented Thinking] by Ward Cunningham and Kent Beck | |||
* [http://books.google.com/books?id=SGOyQai2TboC&printsec=frontcover&dq=CRC+card+book&hl=en&ei=xSOaTKSaNISclgfRqtkK&sa=X&oi=book_result&ct=result&resnum=1&ved=0CDYQ6AEwAA#v=onepage&q&f=false The CRC card book] by David Bellin, Susan Suchman Simone | |||
:* [http://www.excelsoftware.com/quickcrcwin.html Quick CRC] | * [http://books.google.com/books?id=baopCOstm_kC&pg=PA29&lpg=PA29&dq=creating+software+for+CRC+cards&source=bl&ots=hABGQbbmXV&sig=CTHPtCN1GmZEyTAIPWvKE--8-M4&hl=en&ei=7ReaTISDKYL68Aadtq08&sa=X&oi=book_result&ct=result&resnum=9&ved=0CEsQ6AEwCDgK#v=onepage&q&f=false Using CRC Cards: An Informal Approach to Object-Oriented Development] | ||
* [http://www.agilemodeling.com/artifacts/crcModel.htm Modelling CRC Cards] | |||
* [http://www.excelsoftware.com/quickcrcwin.html Quick CRC] |
Latest revision as of 17:49, 22 September 2010
Introduction
CRC Cards also known as Class-Responsibility-Collaboration cards are a brainstorming tool to enable collaboration across different teams or individuals in contribution to design, usually used in Object Oriented Software development. This was proposed by Ward Cunningham and Kent Beck[1]. The CRC card can be viewed as an index card, with the following details:
- The Top of the card usually bears the name of the class.
- The Left side of the card has the responsibilities of the class.
- The Right side of the card has the collaborating classes corresponding to each of the responsibilities listed in the left side.
Thus in general, a CRC session can be viewed as the interaction between a set of collaborating classes for a particular Use case.
According to [2]A CRC session proceeds with someone simulating the system by talking about which objects send messages to other objects. By stepping through the process weaknesses and problems are easily uncovered. Design alternatives can be explored quickly by simulating the design being proposed.
A CRC Example
To better understand how the CRC cards work together, let us consider a simple student enrollment problem,where we are required to model the students enrolled in different courses. We can easily define the Student CRC Card as having attributes such as student name, student id and responsibilities that enable a student to enroll in a course or drop the course. In this particular instance, the collaborating class would be the Course class. The Course CRC Card can in turn be visualized as having its own responsibilities, such as having attributes like Course Id, course name and the collaborating class would be the Instructor
class. The CRC cards for the Student class and the Course Class are shown below.
There are also several practical designs that use the CRC card model to design Object oriented software design. The Simulator for Coffee Maker explores an Extreme Programming approach combined with CRC card technique to come up with a design for the coffee maker.
Another interesting approach using CRC cards explores a design for the ATM Machine
Advantages of CRC cards
There are quite a few advantages of CRC cards that make it a preferable model in many designs. Some of the advantages of the CRC card design method are
- CRC cards can allow designers to easily make audience understand a very complex system. In essence it allows for building more complex designs by slowly building the interactions between the collaborating classes, one by one.
- CRC cards are a simple technique and it can be easily used by anyone with very little training and does not require any expensive computing resources(a board or a paper and a pen would suffice).
- CRC is fundamentally a brainstorming tool, enabling different people in a team to come up with the design by collaborating, enabling everyone in the team to contribute
- CRC can be used with other formal object oriented design methodologies such as Extreme Programming (an Agile development Technique) and can be used along with modelling languages such as Unified Modeling Language(UML)
Why need a Software for CRC Cards
CRC cards are limited by their scope. If we go about designing a huge project, the scope spans many classes and interactions between them. The tedious task of maintaining are CRC cards and to properly formulate interaction can get overwhelming. Following reasons propel use for software for CRC Cards :
- Designing Scenario: A scenario represents series of steps in which classes and objects communicate. There are be references to other cards or scenarios.
- Modeling : Software provide an easy way to segregate cards and objects into different diagrams. Thus we can model our software with different functionality very easily.
- Simulation : Software can provides simulation of an software design. This might include single stepping backwards, forwards a scenario or jumping to a specific location in the scenario stack of a multiple scenario simulation
- Synchronization and Dependencies: Software can maintain relationships between cards, scenarios as design changes take place. If a card references other cards or classes, those cards are generated automatically. Also any name changes and cross references between objects are instantly updated.
- Revision history and Version Control : Software for CRC cards supports changes to CRC cards. It is easy to model and keep track of all changes to a CRC cards. This is extremely helpful in realizing the design changes to CRC cards.
Desining Software
The following steps proceed while designing Software for CRC cards:
- Create CRC Cards
A CRC model is usually created by an individual or small group of designers during the early phase of an object-oriented development project.The figure shows the design of hierarchy of classes. These set of class used for drawing objects are shown. We can see TShape class has a superclass called TObject and two subclasses, TBox and TCircle. Lets assume we create new class TWindow derived from the superclass TObject.
- Assign Responsibilities
Once a set of classes are defined, behaviors can be assigned that will provide the functions of the application. For example, the TShape card has responsibilities Initialize to create it and Draw to illustrate it on the diagram.
- Add Attributes
Attributes of classes may also be identified in a CRC Card.The TShape class has attributes fPosition, fType and fSelected.
- Define and simulate Scenario
A scenario describes a sequence of steps in the design using the responsibilities of a group of collaborating classes. Collaboration between classes refers to a client object that uses a responsibility performed by a server object. Often a class must call upon several collaborating classes to implement one of its responsibilities.A scenario describes what happens in the system from a high-level, user point of view.
Consider situation to the right. We have defined two CRC cards with their responsibility. A scenario deinfes several steps. Each step in a scenario has a Client, Server and Responsibility field. For each step, a client class uses a responsibility of a server class
The Open Document scenario in the picture references the Initialize Document subscenario by specifying its server class Document in the server field and its scenario name in the Responsibility field. The first step in the Initialize Document subscenario uses Document as the server class name.
By single stepping forwards, backwards or through each subscenario, bugs in the design can be identified and corrected early.
- Partition the Design
As the number of CRC cards in the design grows, they can be grouped by function. Using Software for CRC cards, separate diagrams are used to partition the model into different subject areas.
- Inheritance Graph
An automated tool can generate an inheritance graph from information on CRC cards. This diagram can concisely illustrate the big picture of a large project that might contain hundreds of classes and dozens of diagrams.
- Verify Your Work
Creating and simulating scenarios will help verify that a design is correct and complete. A CRC software can perform other error checks to locate design problems. For example, responsibilities that are not used in any scenarios may indicate that the design is incomplete or perhaps the responsibility isn't needed.Likewise, a card that is not used by any collaboration may not be needed.
Summary
Software for CRC cards are immensely helpful in designing and modeling Software development using CRC cards.As the size of object-oriented system grow, it becomes increasingly difficult to model the problem with index based CRC cards. Thus an automated tool is required to maintain design and clear functionality.
See Also
References
[1] A Laboratory For Teaching Object-Oriented Thinking: http://c2.com/doc/oopsla89/paper.html
[2] CRC Cards: http://www.extremeprogramming.org/rules/crccards.html
[3] A Simulator for Coffee Maker
[4] CRC Card for ATM
External Links
- A Laboratory For Teaching Object-Oriented Thinking by Ward Cunningham and Kent Beck
- The CRC card book by David Bellin, Susan Suchman Simone