< previous page page_937 next page >

Page 937
To associate these operations with the appropriate objects, let's make an object table as follows:
Object
Operation
File punchInFile
Input data from the file
ID number
Input an employee ID
Time card
Punch a time card
Look up time card information
Print out time card information
Time stamp

Analyzing the object table, we see that something is not quite right. For one thing, Look up time card information is not an operation on a single time cardit's more properly an operation that applies to a collection of time cards. What we're missing is an object that represents a list of time cards. That is, the program should read all the time cards from the data file and store them into a list. From this list, our program can look up the time card that matches a particular employee ID. Notice that this new objectthe time card listis an implementation-level object rather than a problem-domain object. This object is not readily apparent in the problem domain, yet we need it in order to design and implement the program.
Another thing we notice in the object table is the absence of any operations on the time stamp object. A little thought should convince us that this object simply represents the time of day. As with the Time class we discussed in this chapter, suitable operations might be to set the time and to print the time.
Here is a revised object table that includes the time card list object and refines the operations that might be suitable for each object:
Object
Operation
File punchInFile
Open the file
Input data from the file
ID number
Input an employee ID
Print an employee ID
Time card
Set the ID number on a time card
Inspect the ID number on a time card
Punch the time stamp on a time card
Inspect the time stamp on a time card
Print the time card information
Time card list
Read all time cards into the list
Look up time card information
Time stamp
Set the time of day
Print the time

 
< previous page page_937 next page >