Cay Horstmann & Timothy Budd

Laboratory Notebook
Chapter 13 - Object-Oriented Design

Your name:
Your email address:
Your student ID number:

Once this form has been customized for your institution, you can use this button to send your lab work. Be sure to read the instructions before starting your work.

Lab Objectives

To gain experience with

R1. Discovering Classes and Member Functions

As you recall from your text, the object-oriented design process involves carrying out three tasks:

1. Discovering classes.
2. Determining the responsibilities of each class.
3. Describing the relationships between classes.

When given a set of user requirements, you can determine classes by looking for nouns in a class description. Let's look at an example:

Our client, a distribution center, would like to print out a packing list for each shipment. The packing list will contain the name of the recipient, a description of each item shipped, the total quantity of each item shipped, as well as the unit cost. The packing list should also show the total number of items shipped. A sample packing list appears below:

Packing List

Item Number Description Quantity Unit_Price
234 Widgets 232 $0.01
321 Wrenches 3 $1.56
Total Number of Items: 235

What classes do you think can be discovered from our packing list?

Once we have discovered the classes, we now need to come up with some member functions. These can be discovered by looking for verbs in the task description.. For example, some class needs to find the price of an item. What other member functions, or behaviors, can you identify?

Once we have determined member functions, we now need to look at whether other classes are needed to perform the function. Those that are needed are called collaborators. In the next section, you will use the CRC card method to determine classes, member functions and collaborators.

P1.  CRC Cards

The CRC card method is a good way to discover classes, member functions and collaborators. Your book provides several examples of using the CRC card method. For this exercise, you will need to develop CRC cards for a repair work order application. A typical repair work order is shown below. We have provided space for you to create CRC cards and submit these to your instructor. Please note, the number of CRC cards provided does not necessarily map exactly to the number of CRC cards required.

Repair Work Order

Customer Name: John Samartha  

Date In: 07/20/2002

Address: 1009 Southside Drive  

Date Promised: 08/20/2002

Chicago, IL 60606  

Estimated Hours: 24

Telephone: (612) 232-3322  

Technician: D. Smith


Estimated Cost: $987

Item: Vacuum Cleaner Model No: 212BN Serial Number: 2020202
Problem Description: Smells of burning rubber. Does not pick up dirt.

P2. UML Diagrams

After completing CRC cards for the repair order application, create a UML Diagram. You can do this using a word processor, such as Microsoft Word, and then paste the diagram into the text area below. Remember to use the following relationship symbols:
Relationship Line Style Arrow Tip
Inheritance Solid Closed
Association Solid Open
Dependency Dotted Open

P3. The Five Part Development Process

There is a five part development process recommended for you to use when designing an application:

1. Gather requirements.
2. Use CRC cards to find classes, responsibilities and collaborators.
3. Use UML diagrams to record class relationships.
4. Document classes and member functions.
5. Implement your program.

In this section, you will complete an application from start to finish using this development process.

First, let's gather the requirements. This application prints out a grade report for students. A sample grade report appears below:

Grade Report

Name: Henry M. Joseph

Semester: Fall 2001

Address: 453 Trebbor Road

Major: Chemistry

Bolton, MA 02321

Expected Year of Graduation: 2005

SID: 043-23-2123  
Class Grade
Physical Chemistry A
Molecular Biology A
Differential Equations A
Analytical Chemistry A
Semester GPA: 4.0 Cumulative GPA: 3.8

Now that we have an idea of the requirements, let's complete CRC cards. Please create your CRC cards using the space below.

Next, create UML diagrams from the CRC cards. Use a word processor or other drawing tool and paste your UML diagram into the space below:

The next step in design, prior to implementation, is writing documentation for the discovered classes and member functions. Insert your documentation in the space below:

Now that the design is complete, you have a framework from which to build your complete application. Paste your code in the space below:

Do not forget to send your answers when you are finished.