< previous page page_936 next page >

Page 936
Enter an employee ID (negative to quit): 129336
ID: 129336 Time: 08:15:29

Enter an employee ID (negative to quit): 222000
222000 has not punched in yet.

Enter an employee ID (negative to quit): -3
Discussion: Using structured (top-down) design, we would begin by thinking about the overall flow of control and the major actions to be performed. With object-oriented design, we consider the overall flow of control last.
We begin our design by identifying objects and their associated operations. The best place to start is by examining the problem domain. In object-oriented fashion, we search for important nouns and noun phrases in the problem definition. Here is a list of candidate objects (potential objects):
Factory
Employee
File punchInFile
ID number
Time card
Time stamp (punch-in time)
User
Reviewing this list, we conclude that the first two candidatesfactory and employeeare probably not objects in the solution domain. In the problem we are to solve, a factory and an employee have no useful properties or interesting operations. Also, we can eliminate the last candidate listeda user. User is merely a noun appearing in the problem definition; it has nothing to do with the problem domain. At this point, we can pare down our list of potential objects to the following:
File punchInFile
ID number
Time card
Time stamp
To determine operations on these objects, we look for significant verb phrases in the problem definition. Here are some possibilities:
Punch a time card
Input data from the file
Look up time card information
Print out time card information
Input an employee ID

 
< previous page page_936 next page >