You have a bunch o’ data. You’re asked to write a program to summarize or transform the data in some way.
Use the pattern:
Extract Process Output
This is a variant of the input-process-output pattern.
Keep the three chunks separate for
- Easy writing, debugging, and testing. Easy is Good.
- Flexibility. For example, you can change the data that’s extracted, without touching processing or output.
From the original data set, extract some of the data for analysis. For example:
- Data with no errors.
- Data on students with a GPA of 2.2 or below.
- Stocks that have fallen by more than 10% in the past year.
Extract the data to an array, a worksheet, or a file.
Often you’ll need to use loops and the accumulator pattern.
Output to a worksheet, Web page, whatevs.