Module 2

Module 2 - The design recipe Readings: We have already...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The design recipe Readings: We have already covered through section 2.2 in HtDP; this module covers through the end of section 5. We are covering the same material as the text, but using different examples and in a different order. Lectures do not cover all the details, so keeping up with the readings is important. You should read the sections in the Survival Guide dealing with assignment style and electronic submission. CS 135 Fall 2008 02: The design recipe 1 Programs as communication Every program is an act of communication: Between you and the computer Between you and yourself in the future Between you and others A semicolon ( ; ) in a Scheme program indicates that the rest of the line is a comment that can be ignored by the computer but is important to a human reader. CS 135 Fall 2008 02: The design recipe 2 Goals for software design Its easy to get the (incorrect) impression that the main goal is to get the program running and make it fast. In fact, there are a number of other important goals. Programs should be compatible, composable, durable, extensible, flexible, maintainable, portable, readable, reliable, reusable, scalable, usable, and useful. This is just a partial list. We can only touch on a few of these points in CS 135 (and a few more in CS 136). CS 135 Fall 2008 02: The design recipe 3 The design recipe We expect you to follow the design recipe for every function you write in this course. The design recipe is a development process that leaves behind written explanation of the development. At the end of it, you will have a function which you can trust (because it has been tested) and which future readers (you or others) can understand. CS 135 Fall 2008 02: The design recipe 4 The design recipe has two parts. One part consists of five components, the first three of which are human-readable, but ignored by the machine. Later on, we will add a second part, a template (pattern) which is a guide to how the function should be written. The components of the design recipe vary depending on the style of function being developed. CS 135 Fall 2008 02: The design recipe 5 The five design recipe components Contract: Describes what type of arguments the function consumes and what type of value it produces. So far, functions can only consume numbers and produce a number, but we will soon see different types of data. Purpose: Describes what the function is to compute. The purpose should be written in such a way that the meaning of each function parameter is evident. CS 135 Fall 2008 02: The design recipe 6 Examples: Illustrating the use of the function. The examples should be chosen so that they aid in the development of the function. Definition: The Scheme definition of the function....
View Full Document

Page1 / 20

Module 2 - The design recipe Readings: We have already...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online