2OBJECTIVES After completing this tutorial, you shall be able to Know what CRC card is and its historyKnow a CRC card session and runUse CRC for analysis and design of a real object-oriented applicationKnow CASE tools for CRC cardsKnow its strengths and limitations
3OUTLINE Introduction:OO Concepts and Vocabulary CRC: Overview CRC Cards for AnalysisCRC Cards for DesignDocumenting a CRC Card DesignCASE Tools for CRC Card DesignExercise: ATM Simulation using CRCDiscussions on the results of the exercise
5INTRODUCTION“Object-oriented programming offers a new and powerful model for writing computer software. This approach speeds the development of new programs, and, if properly used, improves the maintenance, reusability, and modifiability of software. O-O programming requires a major shift in thinking by programmers, however. The C++ language offers an easier transition via C, but it still requires an O-O design approach in order to make proper use of this technology. … .”Source:http://catalog.com/softinfo/objects.html
6OO Concepts and Vocabulary OO v/s Non-OONon-Object-Oriented (Traditional)Data and Procedures are kept SeparateProcedures work on Data to produce resultsObject-orientedFocus on Responsibilities - to be satisfied by ObjectsResponsibilities translate into Data and Functions within an ObjectObjects have behaviorProceduresDataSIMILARITIES AND DIFFERENCESProceduresDataSource: Dr. Seaman’s Lecture Note
7OO Concepts and Vocabulary(Cont OO Concepts and Vocabulary(Cont.) Phases of OO Systems Development CycleImplementationprogrammingdatabase accessSystem Designsystem architecturedatabase accessdata structurealgorithmscontrolsObject DesignAnalysisapplicationwhatSource: Jeffrey(1999). Advanced System Analysis and Design
8OO Concepts and Vocabulary (Cont.) Objects:State,Behavior,IdentityObject-Oriented ModelEncapsulationInstantiation:Classes and ObjectsInheritance:Classes,Super-classes,and SubclassAbstract ClassesPolymorphismFramework and Patterns
10WHAT’S CRC Card?CRC stands for Class,Responsibility,and Collaboration.ClassA set of objects that share common structure and common behaviorSuper-class : a class from which another class inheritsSubclass: a class that inherits from one or more classesResponsibilitySome behavior for which an object is held accountable.Collaborationprocess whereby several objects cooperate to provide some higher-level behavior.
11WHAT’S CRC CARD? (Cont.)An index card that is annotated in a group setting to represent a class of objects,its behavior,and its interactions.An informal approach to OO modelingCreated through scenarios,based on the system requirements,that model the behavior of the system.
12WHAT’S CRC MODELING CRC Modeling is used: to develop an OO system more easily to teach people about objects and their relationships without teaching them an entire programming language (or even mention programming)CRC is implemented using the requirements given to a teamEach class is written down on a 3x5 (4x6) inch index card
14REQUIREMENTS Cards should be physical cards, not virtual cards. CASE tools for support of CRC cards are useful,but cannot replace the interaction that physical cards facilitate.3x5 or 4x6 inch are the perfect size. But you can really use anything you want. ….Napkins???Denny’s???Refreshment (Optional)
15HISTORYIntroduced at OOPSLA in 1989 by Kent Beck and Ward Cunningham as an approach for teaching object-oriented design.In 1995,CRC cards are used extensively in teaching and exploring early design ideas.CRC cards have become increasingly popular in recent years. As formal methods proliferate, CRC cards have become, for some projects,the simple low-risk alternative for doing object-oriented development.
16THE CRC CARD SESSIONThe session includes a physical simulation of the system and execution of scenarios.Principles of successful sessionAll ideas are potential good ideasFlexibilityGroup DynamicPrinciples (Similar to the JAD Session)
17BEFORE THE SESSION Forming the Group The ideal size for the CRC card team:5 or 6 peopleThe team should be composed ofOne or two domain expertstwo analystsan experienced OO designerone group’s leader/facilitatorRoles of the participants and the rule of the game
18The CRC Card Team Source:The CRC Card Book by Bellin et.al (1997) Forewords by Kent Beck & Ward CunninghamSource:The CRC Card Book by Bellin et.al (1997)
19DURING THE SESSIONAll the group members are responsible for holding,moving and annotating one or more cards as message fly around the system.Group members create,supplement,stack,and wave cards during the walk-through of scenarios.A session scriber writes the scenarios.
20PROCESS 1.Brainstorming (Productive thinking) One useful tool is to find all of the nouns and verbs in the problem statement.2. Classes IdentificationThe list of classes will grow and then shrink as the group filters out the good ones.3. Scenario execution(Role play)The heart of the CRC card sessionWith CRC cards,a group of people throw together their ideas about what a system should do,compare them,and synthesize them into a set of classes recorded on CRC cards.HOW? mean? Where to Start? When to stop? What to Identify? What Scenario is?What Role Plays
21STRENGTHS The cards and the exercise are non-threatening & informal Provide a good environment for working and learning.Inexpensive,portable,flexible,and readily availableAllow the participants to experience first hand how the system will workUseful tool for teaching people the object-oriented paradigm
22LIMITATIONS Provide only limited help in the aspects of design. Do not have enough notational power to document all the necessary components of a system.Do not specify implementation specifics.Can not provide view of the states through which objects transition during their life cycle.
23CRC GOOD PRACTICE Start with the simplest scenarios. Take the time to select meaningful class names.Take the time to write a description of the class.If in doubt,act it out!Layout the cards on the table to get an intuitive feel for system structure.Be prepared to be flexible.
24Analysis techniques to OO development focus on discovering: CRC CARDS FOR ANALYSISOverviewAnalysis techniques to OO development focus on discovering:problem and application domains’ objects and classesrelationships that exist between these objects & classesway that objects undergo state changes and/or interact with each other over time
25CRC for Analysis CRC Elements in Analysis: Analysis classes: classes, scenarios, responsibilities & collaboratorsUse the CRC Card sessions to elicit analysis classes, responsibilities and collaborationsAnalysis classes:are classes those describe what the system doesreflect concepts and entities that are part of the domain of being modeledobjects of these classes collaborate to describe what the application doesTo create an OO model of an application
26Case Example: A small technical library system for an R&D organization Requirement StatementThe CRC Card SessionsParticipants (Who? Why?)Brainstorming (Scope)Creating Classes (the first step)BrainstormingSuggesting Classes (your suggestions)Filtering
27Case example: Finding Classes Suggested ClassesLibrary, Librarian, User, Borrower, Article, Material, Item, Due Date, Fine, Lendable, Book, Video, and JournalClasses after filteringLibrarian, Lendable, Book, Video, Journal, Date, Borrower and UserAssigning CardsA CRC Card per Class, put name & description of the class
28Scenarios executions/Role Plays (For what?) Filter & test identified classesIdentify additional classesIdentify Responsibilities and collaboratorscan be derived from the requirements/use casesresponsibilities that are "obvious" from the name of the class (Cautious, avoid extraneous responsibilities)Filtering and testing R & CAttributes(Only important ones are noted)
29Finding Responsibilities Are things that the class has knowledge about itself, or things that the class can do with the knowledge it hasTips/IndicatorsVerb extractions in the problem or use caseAsk what the class knows? What/how the class does ?Ask what information must be stored about the class to make it unique?
30Finding Collaborators A class ask another class whenneeds information that it does not have orneeds to modify information that it does not haveClient (Requester for services) - Server (Services Provider) relationshipTips/IndicatorsAsk what the class does not knows and need to know? And who can provide that?
31Case example: Scenarios Execution(cont.) Identify Scenarios (By domain experts)Main Categories: check-out, return and searchCHECK-OUT SCENARIOWho should have the overall responsibilities for the task/check out? Librarian.What does the task/checking out a book entails?Refer to the Script to follow the process (handed to students)
32Case example: Scenarios Execution(cont.) Major QuestionsShouldn't there be collaborations in the opposite direction?Collaborations in CRC cards are one-way relationships from the client to the server (OO)Who should do the checking out of the Book? Librarian or Book itself? (Controversial)Who should tell Borrower to update its knowledge about outstanding Book? Librarian or Book?
33Case example: Scenarios Execution(cont.) Do we need a collaboration between Book and Borrower for the know set of books responsibility?Collaborations are not usually needed for responsibilities that simply hold information. Instead, Collaboration is needed only for situations where an object actually sends a message to a Collaborator.Borrower does not need Book's help to put a Book in a set.
35Case example: Scenarios Execution(cont.) Remarks:Domain experts have a lot contributionThe first scenario takes the longest to walk-through and set the frameworkRelated scenariosSuperclass discoveryReturn scenariosExceptional scenarios
36Case example: Scenarios Execution(cont.) Search Scenario"What happens when Ned comes to Library in search of a book entitled The Mythical Mammoth?"Discovery of new class: Collection class (Why?)Book can’t look for itself, identity of the book is not knowCollection looks over a set Books to find the correctAttributes for searching (can be done at Design stage)When to end scenario execution?Get a stable model (does not cause new C or R to be added)
37Grouping Cards· CRC cards on the table provides a visual representation of the emerging model· Classes with hierarchical (is-a relationship)· Class who collaborate heavily placed closer· Class included by other class (has-a relationship); e.g. Date in Lendable· Card clustering based on heavy usage or collaborations can provide visual clues to subsystems
38Deliverables Documenting a CRC Card Analysis Complete list of Library Application CRC CardsList of scenarios recorded as suggested and executedCollaboration DiagramApplication Problem Model
39Strength & Limitation for Analysis Common Project VocabularySpreading Domain KnowledgeMaking the Paradigm Shift (Role play)“Every participant is an object, everything happens does so because an object makes it happen” (Wilkinson 1995)Live Prototypingto show what the system suppose to do to customers, new member, testers, developers, etc.Identify Holes in the RequirementsLimitation
40CRC CARDS for DESGIN Goal of CRC card design process Expansion and refinement of the Analysis CRCAt level where implementation will be fairly clearAnalysis Classes - describe what the system does. Design Classes - describe how the system works.1..N Analysis ClassesCRC Card design sessions: Additional classes and mechanisms are built upon the existing analysis classes0..N Design Classes
41Design Design classes: are classes those describe how the system does reflect concepts used by designers and programmers to describe their implementation techniquesinclude classes that contain the data structures and operations used to implement the analysis as well as classes representing the user interfaces, DBMS, error handlers, etc.objects of these classes collaborate to describe how the application goals will be accomplished
42Design Design Constraints Target Environment and Language Choice of Supporting Software Components: GUI and DBM systems; general and special purpose libraries and frameworksClass LibrariesPerformance Requirements: response-time/ speed, expected availability, load in terms of number of usersErrors/Exceptional HandlingOther: Security, Memory, etc. constraints
43Applying CRC cards for Design Elements: CRC, Attributes, scenarios, sub-responsibilities, Lifetime of objectsClassesAdditions that represent mechanisms that support implementation of the problem e.g. Search classClasses contain the data structures and operations used to implement the analysis classes e.g. Array, ListInterface classes for UI and DBM subsystemsClasses to handle error conditions
44Applying CRC cards for Design Scenarios, Responsibilities & Collaboratorstake the implementers’ point of view in fulfilling these scenarios, i.e., detailing all system functions (responsibilities), including those that provide support functions (collaborators)Sub-responsibilities to be addedCollaborating sub-responsibilities to be addedMessage Data Passed (can be differed until the low-level design)The Process:Problem-modeling scenarios are repeated along with additional new scenarios as neededHigh-level responsibilities & collaborators are used, and detailed and expanded
45Applying CRC cards for Design The distinction between objects and classes becomes more important, and the following questions, are answered will be an important part of its design.Who creates this object?What happens when it is created and adopted?What is the lifetime of the object vs. the life time of the information (persistence) held by an object?AttributesDiscovery of attributes that are necessary to support the task during examination of each responsibilityWhat attributes of objects need to be saved persistentlyLeads to a database design (database model)
46Case: Library Application Design Group: Who and why?The two designers (Cecilia and Jim), OO expert (Nancy) as a facilitator, Betty (a domain expert/user)Input: CRC cards, Scenarios, diagrams, etc. from Analysis stage; Design ConstraintsThe Session/ProcessBrainstormingAdd sub-responsibilities while revising the analysis classesAdd data/object that is passed with the message being sent (can be differed at the end of the design stage as it takes the design to low level)Figure 5.3. pp. 116
47Case: Library Application Design Brainstorming any classes that comes to mind based on design constraints such asUser Interface, Database access, Mechanisms for implementation of analysis classes, error handlingsUser Interact class & DB interface ClassesScenarios identification and executionsObject creation scenariosCheck-out ScenarioReturn ScenarioSearch ScenarioOutput: Design classes
48Case: Library Application Design Classes that serves as interfaces to other subsystems (UI and DBMS)Principles:make independent of specific hardware and software productsuse specific class names instead of generic names such as GUI and DBMSUser interface: to get input from and display to user using GUI software classesUI manager, User Interacter classes are suggested.
49Case: Library Application Design Database: To obtain and store Borrower objects and objects of the Lendable classes using DBMS softwareScenario Executions (Scripts given)Creation Scenarios (System start-up)Check-out scenarioOthers
50Case: Library Application Design some important issues during Scenarios executionHow to verify the ID? Who? Librarian? A new class?How the Lendables set are stored and manipulated? Data Structure issues? List is chosenScenarios, Scenarios, ScenariosWork on normal and exceptional (Error handling class)When to start Prototyping?
51Deliverables Documenting a CRC Card Design List of design classes (pp )Class models: Hierarchies and collaboration graphs (pp )Scenario Descriptions (pp )
52Strength & Limitation for Design Common project vocabularySpread of domain knowledgeSpreading OO design expertiseDesign ReviewsFrame for implementationInformal notation“Designing is not the act of drawing a diagram” (Booch)Limitations
53CASE tools for CRC Card An automated tool to support CRC cards Quick CRC from Excel SoftwareFrom SpiralSoftRational & others Modeling Methods and CASE Tools.Features
55ReferencesWilkinson, N. C. (1995). Using CRC cards: An informal approach to object-oriented development. SIGS Book, USABellin, D. and Simone, S. S The CRC Card Book. Addison Wesley Longman, Inc.: USA.Beck, Kent, and Ward Cunningham. " A Laboratory for Teaching Object-Oriented Thinking." OOPSLA-89 Proceedings, SIGPLAN Notices 24 (10): 1-6 (October 1989). URL:Jeffrey, H. and et al. (1999). Modern systems analysis and design. Reading, Mass: Addison-Wesely.Bjork, R. C ATM Simulation Links - by Topic.Techniques for Object Oriented Analysis and Design.Object-Oriented Design Using CRC Cards.Malan, R., et al. (1995). Lessons from the Experiences of Leading-Edge Object Technology Projects in Hewlett-Packard. OOPSLA'95 Conference Proceedings, Austin, Texas.Hutt, A.(1994). Object Analysis and Design: Description of Methods. JohnWilley & Sons, Inc., New York.Fowler, Martin. (1997). A survey of object oriented analysis and design methods.
56Reference (Cont.)A tool for designing Java programs with UML . Proceedings of the 4th annual SIGCSE/SIGCUE on Innovation and technology in computer science education, June , 1999, Krakow PolandObject-oriented practice in 1998 (panel): does it help or hinder collaboration? PagesCRC CARD CONSTRUCTOR.Techniques for Object Oriented Analysis and Design.Cockburn, A. (March 1999) Using CRC Cards [Online]. [03/29/2001].SpiralSoft Home Page.Object-Oriented Design Using CRC Cards.Object-Oriented Analysis PhaseModeling Methods and CASE Tools.