Title: CRC ClassResponsibilityCollaboration Cards EEE321'20
1CRCClass-Responsibility-Collaboration Cards
EEE321.20
Royal Military College of Canada Electrical and
Computer Engineering
- Maj JW Paul
- Jeff.Paul_at_rmc.ca
- 1-613-541-6000 x6656
Ref Ambler Chap 3.5
2Midterm Review
3public class Main public static void
main(String args) ValueHolder v new
ValueHolder() Printer p new Printer(v)
InputHandler h new InputHandler(v)
h.event()
public class ValueHolder protected Printer
printer protected int val public
ValueHolder() val 0 public void
setPrinter(Printer p) printer p public
void changed() printer.inform() public
void setVal(int newVal) if (val !
newVal) val newVal changed()
public int getVal() return val public
class Printer ValueHolder myValue public
Printer(ValueHolder v) myValue
v v.setPrinter(this) public void inform()
System.out.println(myValue.getVal())
public class InputHandler ValueHolder
myValue public InputHandler(ValueHolder v)
myValue v public void event()
myValue.setVal(myValue.getVal()1)
4(No Transcript)
5(No Transcript)
6Todays Class
7(No Transcript)
8Review
- Figure out the WHAT (never stops)
- What is the purpose of Requirements Analysis?
Two models we used to capture this information?
- Domain Model
- Use Cases
- (brainstorming)
Aside - types of use cases
- scenario (specific path)
- narrative (general description)
- dialog (interaction between user and software)
9Analysis vs Design Model
- The heart of the solution (design) is the
creation of interaction diagrams which illustrate
how objects collaborate to fulfil the
requirements - Iteratively
- In practice, the identification and creation of
classes happens in parallel and synergistically,
but conceptually they respectively belong to the
analysis and design aspect of software
development.
10(No Transcript)
11CRC Cards
12CRC Cards
- Class-Responsibility-Collaboration Cards
Class Name
Class Responsibilities
Class Collaborations
http//c2.com/doc/oopsla89/paper.html
http//www.softstar-inc.com/Download/Intro to
CRC.pdf
13CRC Details
- Class
- A Class represents a collection of similar
objects. Objects are things of interest in the
system being modeled. They can be a person,
place, thing, or any other concept important to
the system at hand. - Responsibility
- A Responsibility is anything that the class knows
or does. These responsibilities are things that
the class has knowledge about itself, or things
the class can do with the knowledge it has. - Collaborators
- A Collaborator is another class that is used to
get information for, or perform actions for the
class at hand. It often works with a particular
class to complete a step (or steps) in a scenario
14ATM System Example
15The Gymnastics System
16The Gymnastics System
We are about to model a gymnastics scoring
system. Our mission is to automate the
definition, registration, scoring, and record
keeping of a gymnastic season. Here is a quick
description of a gymnastics league and one of
their contests A league is a group of teams that
compete against each other. Each of these clubs
recruits members to participate in the
contests. A typical meet consists of several
contests held in the course of one day. For
example, there may be a women's all-around, a
women's individual, a men's all-around, and so
on. There may also be junior and senior
competitions. When a team enters a meet, it
enters all the competitions. For each contest,
each team enters the same number of members, who
must compete in all parts of the
competition. Each competition is a series of
events run on different equipment. For example,
the women's competitions involve balance beam,
vault, high bar, and floor exercise. All pieces
of equipment are in operation at the same time
each team's competing gymnasts perform on one
piece of equipment and then rotate to the next.
17The Gymnastics System
Each event has a judging panel assigned to it.
These people are qualified scorers for this
event. Each judge rates each gymnast on the event
and reports the score to a scorekeeper. The
scorekeeper throws out the high and low scores
and averages the rest. This is the gymnast's
score for the event. The team score is the sum of
all gymnasts' scores. Competition scores are the
sum of the scores for each of the events. Meet
scores are the sum of the competition scores, and
so on. In addition to running the individual
meets, the league prepares the schedule of meets
for the season, ensures that qualified judges are
assigned, registers teams and gymnasts, and
publishes seasonal standings.
18Meet Town InvitationalCompetition Womens
Senior TeamDate 12/3/92
19Use Case Diagram
20The Gymnastics System
- Work through micro process to develop first
iteration of domain analysis - Identify the classes and objects at a given level
of abstraction - Identify the semantics of these classes and
objects - Identify the relationships among these classes
and objects - Specify the interface and then the implementation
of these classes and objects
21Initial Class Diagram