In this course we use an approach to program design based on recipes - sets of steps that guide us through a systematic process of designing programs. Our core recipe is made up of six steps. Some of those steps involve multiple components, and there are some important interactions between certain steps/components of the recipe. This page provides an overview of the core steps of the recipe, with links to pages that provide more details on certain aspects.
| Step | Goal | Program Artifact |
|---|---|---|
| 1. Problem and Data Analysis | Understand the problem and decide how to represent relevant information as data. | Data Definition |
| 2. Signature, purpose, stub | Name the function; specify types of input and output; describe its purpose | Commented function signature and purpose statement; simplistic (but working) function definition (header/stub) |
| 3. Functional Examples | Characterize relationship between input and output through concrete examples; show what the function should produce when applied |
check-expect forms
|
| 4. Template | Sketch out what data the function has to work with; what are all the parts that you have to put it together? |
Skeleton of function body
with ... (dots, to be filled in)
|
| 5. Body | Define the function; put things together | A completed function definition that uses primitive operations, other functions, and the pieces of your template |
| 6. Test | Discover and fix mistakes (logical errors) |
An All tests passed.
message when run.
|
How to Design Functions - focusing on steps 2 through 6 above.
How to Design Data Definitions - focusing on step 1 above (and its interaction with steps 3 and 4).