< previous page page_931 next page >

Page 931
bank tellers, spreadsheet rows, spreadsheet columns, robot arms, robot legs. The computer program that solves the real-life problem also includes objects (the solution domain)counters, lists, menus, windows, and so forth. OOD is based on the philosophy that programs are easier to write and understand if the major objects in a program correspond closely to the objects in the problem domain.
There are many ways in which to perform object-oriented design. Different authors advocate different techniques. Our purpose is not to choose one particular technique or to present a summary of all the techniques. It is to describe a three-step process that captures the essence of OOD:
1. Identify the objects and operations.
2. Determine the relationships among objects.
3. Design the driver.
In this section, we do not show a complete example of an object-oriented design of a problem solutionwe save that for the Problem-Solving Case Study at the end of the chapter. Instead, we describe the important issues involved in each of the three steps.
Step 1: Identify the Objects and Operations
Recall that structured (top-down) design begins with identification of the major actions the program is to perform. In contrast, OOD begins by identifying the major objects and the associated operations on those objects. In both design methods, it is often difficult to see where to start.
A good way to start to identify solution-domain objects is to look at the problem domain. More specifically, go to the problem definition and look for important nouns and verbs. The nouns (and noun phrases) may suggest objects; the verbs (and verb phrases) may suggest operations. For example, the problem definition for a banking program might include the following sentences:
The program must handle a customer's savings account. The customer is allowed to deposit funds into the account and withdraw funds from the account, and the bank must pay interest on a quarterly basis.
In these sentences, the key nouns are
Savings account
Customer
and the key verb phrases are
Deposit funds
Withdraw funds
Pay interest
Although we are working with a very small portion of the entire problem definition, the list of nouns suggests two potential objects: savingsAccount

 
< previous page page_931 next page >