Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CRC: Classes, Responsibilities and Collaborations | CS 4311, Papers of Computer Science

Material Type: Paper; Class: Software Eng: Design & Implmnt; Subject: Computer Science; University: University of Texas - El Paso; Term: Unknown 1989;

Typology: Papers

Pre 2010

Uploaded on 08/19/2009

koofers-user-3bf
koofers-user-3bf 🇺🇸

5

(1)

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CRC: Classes, Responsibilities,
and Collaborations
CS 4311
Questions:
What is “Object-Oriented Design”?
Question:
What makes a good class “good”?
Characteristics of a Good Class
Objects Should Responsibilities
Convey a sense of purpose of an object and
its place in the system
Record services that a class provides to
fulfill roles within the system
Record knowledge (maintenance) and
manipulation of information in the system
pf3
pf4
pf5

Partial preview of the text

Download CRC: Classes, Responsibilities and Collaborations | CS 4311 and more Papers Computer Science in PDF only on Docsity!

CRC: Classes, Responsibilities,

and Collaborations

CS 4311

Questions:

  • What is “Object-Oriented Design”?

Question:

  • What makes a good class “good”?

Characteristics of a Good Class

Objects Should Responsibilities

  • Convey a sense of purpose of an object and its place in the system
  • Record services that a class provides to fulfill roles within the system
  • Record knowledge (maintenance) and manipulation of information in the system

Responsibilities

  • “Doing” responsibilities
  • “Knowing” responsibilities

Responsibilities of a class

  • Convey a sense of purpose of an object
  • Every instance of the class has these responsibilities

CRC

  • CRC is a design method.
  • Why CRC?
    • Intuitive.
    • Easy to teach.

CRC Process

  • Identify classes.
  • Identify responsibilities.
  • Assign responsibilities to classes.
  • Identify collaborations.
  • Collect responsibilities into contracts.
  • Define protocols for contracts.

CRC Card

  • One class per card
  • Write subclasses on lines below the name
  • List attributes and purpose on back of card
  • Assign responsibilities

Concrete Class: Numeric Keypad Superclass: Keypad Subclasses: None Responsibilities Collaborations

Abstract Classes

  • An instance of this is never created
  • Single location for behavior common to several related classes

Finding Classes

  • Look at requirements (SRS)
  • Model physical objects
  • Model conceptual entities
  • Choose meaningful word.

Finding Classes 2

  • Be wary of subjects outside the system. Does an object need to act on behalf of the user?
  • Model categories of classes
  • Model known interfaces to world (user interfaces, interfaces to programs).

Identifying Responsibilities

• SRS:

  • find all verbs that represent actions that must be performed
  • Find all information that must be maintained

Assigning Responsibilities

  • Assign every responsibility to some class
  • Evenly distribute the intelligence and work- load
  • State responsibilities as generally as possible
  • Keep behavior with related information
  • Collect information about 1 thing in 1 place

Relationships between classes

  • To identify more responsibilities
  • Types of relations:

Is-Kind-Of Relationship

  • Frequently indicates superclass/subclass
  • Try to identify common attributes or actions
  • Can the superclass capture responsibility of subclasses?
  • Example: LineCreationTool is a kind of CreationTool - One responsibility is to determine the location - This can be shared (Consider TextCreationTool ) - Think about code reuse

Is-Analogous-to Relationship

  • May indicate superclass/subclass.
  • Example LineCreationTool is analogous to TextCreationTool
  • Look for common or similar responsibilities.

Is-part-of

Relationship

  • Not superclass/subclass.
  • The whole need not act like the parts
  • Need to be careful about assigning responsibilities.
  • Object composed of other objects need to know about its parts.

Two Approaches on Distributing

Intelligence Assigning Responsibilities-