< previous page page_27 next page >

Page 27
0027-01.gif
Figure 1-12
Look for Things That Are Familiar
tions may be answered by a later paragraph, or you might have to discuss them with the person who gave you the task.
These are some of the questions you will be asking in the context of programming:
What do I have to work withthat is, what are my data?
What do the data look like?
How much data is there?
How will I know when I have processed all the data?
What should my output look like?
How many times is the process going to be repeated?
What special error conditions might come up?
Look for Things That Are Familiar
Never reinvent the wheel. If a solution exists, use it. If you've solved the same or a similar problem before, just repeat your solution. People are good at recognizing similar situations. We don't have to learn how to go to the store to buy milk, then to buy eggs, then to buy candy. We know that going to the store is always the same; only what we buy is different.
In programming, you will see certain problems again and again in different guises. A good programmer immediately recognizes a subtask he or she has solved before and plugs in the solution. For example, finding the daily high and low temperatures is really the same problem as finding the highest and lowest grades on a test. You want the largest and smallest values in a set of numbers (see Figure 1-12).

 
< previous page page_27 next page >