14.07.2013 Views

Contents - Cultural View

Contents - Cultural View

Contents - Cultural View

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TeachScheme! 295<br />

• a function definition for create-image, which is a one-line function in mathematics, assuming an algebra of<br />

images with place-image, circle, and empty-scene have been introduced;<br />

• two abbreviations, where names are equated with some value, just as in "let x be 5" in an algebra text; and<br />

• one line for running the program.<br />

A teacher can explain create-image as easily as any ordinary function in an algebra course. For example, one can<br />

first draw a table with two rows and n columns where each column contains t at the top and an appropriate image at<br />

the bottom. That is, if the numbers increase from left to right, then on each image the red dot is a little bit lower.<br />

Finally the animate line applies the given function, create-image, at the rate of 28 ticks per second to 0, 1, 2, 3, and<br />

so on. The resulting images are displayed on the computer monitor at the same pace. That's how movies are made.<br />

The background needed for such an example is little more than knowledge about making movies, about the algebra<br />

of pictures in DrRacket (which is like the one for numbers), and minimal pre-algebra. The TeachScheme! project<br />

claims, however, that children would have more fun with such "live" functions than with algebraic expressions that<br />

count the number of garden tiles [see Prentice Hall books for grades 8-9].<br />

The TeachScheme! project proposes that both traditional mathematics as well as science courses could benefit from<br />

an integration of this form of programming. In contrast to the traditional Basic or Visual Basic blocks in such books,<br />

a Racket program consists of as many lines as the mathematics. Moving between the mathematics and the program is<br />

thus straightforward. Better still, the meaning of the two are the same. DrRacket's algebraic stepper can illustrate<br />

how Racket evaluates the program as if it were a sixth or seventh grade student, step by step, using plain algebra.<br />

Functional Programming, Computing and Design in Programming 101<br />

For the introductory curriculum on programming, the TeachScheme! project emphasizes that courses should focus<br />

on the role of systematic design. Even if students never program again, they should see how helpful a systematic<br />

approach to problem solving is. This should help them whether they become programmers or doctors or journalists<br />

or photographers. Thus, an introductory course in programming would not be perceived as a place where students<br />

learn about the syntax of the currently fashionable (and soon-to-be-obsolete) programming languages, but a place<br />

where they can learn something widely applicable.<br />

The key design element of the TeachScheme! curriculum is the design recipe. It has two dimensions: the process<br />

dimension and the data dimension.<br />

Along the process dimension students learn that there are six steps to designing a (simple) program, before they can<br />

run it and others can use it:<br />

• problem analysis with the goal of describing the classes of data that go into the program and come out;<br />

• the reformulation of the problem statement as a concise purpose statement;<br />

• the creation of examples that illustrate the purpose statement and that serve as criteria for success;<br />

• the organization of givens, also called a template or inventory;<br />

• coding;<br />

• and the creation of a test suite from examples to ensure the program works properly on small inputs.<br />

Note that, as in test-driven development, test cases are written before coding, as part of requirements analysis, rather<br />

than afterward as part of testing.<br />

Almost any human endeavour can benefit from clearly understanding the problem, defining criteria for success,<br />

analyzing the available resources/givens, developing a proposed solution, and checking it against the criteria, in that<br />

order. A journalist, for example, benefits from a similar process: figuring out the major concepts in a story; coining a<br />

headline; lining up examples and specific data; organizing the article about the story around the givens and how the<br />

story unfolded; writing; and fact checking.<br />

The data dimension can be summarized by the maxim the shape of the data determines the shape of the code and<br />

tests. For example, if the input or output data type has three variants, a test suite should have at least one test case

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!