ISSEP 2011 Workshop --- Program by Design: TeachScheme! (How to Design Programs)

Overview

The original name of this curriculum, TeachScheme! should be read as teach scheme not. It is not about Scheme language or Scheme programming. It is about program by design, as the new all-encompassing title makes clear.

We will not be using the standard Scheme language, but a specially designed variants, a collection of teaching languages, where every new level introduces new abstractions (ways to represent more general programs).


Workshop materials (references): Level 2 (TeachScheme!)

The complete text of the textbook for this curriculum with many additional materials is available freely on the web. Please, refere to them as you review the lessons from this workshop at home.

Textbook for the Level 2 (secondary schools and introductory university level) course: Original published version: How to Design Programs

Textbook for the Level 2 (secondary schools and introductory university level) course: Revised second edition: How to Design Programs, 2nd ed.

The home page for the Program by Design program contains links to other materials as well as information about workshops, mailing lists, and other ways that help you learn more about this curriculum.

DrRacket      The programming environment for the Level 1 (grades 6 - 8) and the Level 2 (secondary schools and introductory university level) workshop.


Workshop materials (software, tutorials, exercises): Level 2 (TeachScheme!)

For this workshop we have prepared copies of all materials you may need.

All materials have been installed on the lab computers. However, if you want to use the materials on your own laptop or at home, please use the links shown above, as well as the following link.

Programs.zip      The zipped file with the programs we will work on.


Getting started

Start DrRacket application. You will see two windows, the Definition window on the top and the Interactions window on the bottom. One at a time type the following things into the Interactions window and observe the results:

First Program

Download/open the Programs folder. It should have the following program in it: train.rkt, rocket.rkt, ancestor-trees.rkt, model-list-program.rkt, and cars.rkt.

  1. Open the program train.rkt in DrRacket and hit the Run button. Explore the program to see how it is designed. Make any small changes you wish to see how the program behaves. For example, make the train go slower or faster, draw rails for the train, etc. Make sure that you have tests for all the changes you have made.

  2. Now open the rocket.rkt program. It does have an image of a rocket, but the rocket does not fly. Design a program that launches the rocket into the outer space. Follow the design recipe.

  3. Now bring the rocket back home. Design a new program that lands the rocket on the ground.


Working with Complex Data

Open the program ancestor-trees.rkt in DrRacket and hit the Run button.

  1. Now type in the Interactions window the following (one line at a time:

  2. Design a function that will check whether there is anyone in a person's ancestor tree with blue eyes

  3. Design a function that will produce a list of the names of all people in a person's ancestor tree

  4. Open the program model-list-program.rkt in DrRacket and hit the Run button.

  5. Design the method that checks that one list contains every String that appears in the second list, it contains no other Strings, and no String appears there more than once. Note: Do as much as you need to feel comfortable with the design recipe. Finish the rest at home.

Designing World Programs

In the browser open the text of the second edition of the book How to Design Programs, go to the second chapter named Fixed-Size Data, then click on the section Designing World Programs.

Download the program cars.rkt and open the file in DrRacket.

The program contains the code shown in the textbook in Chapter 2 Fixed-Size Data in the section 2.3 Designing World Programs.

  1. Open the program cars.rkt in DrRacket and hit the Run button. Nothing much happens. In the Interactions window type (main 30) and you should see one car going across the screen.

  2. Read the section 2.3 and observe the corresponding program.

  3. Spend the rest of the time adding new features to this world. For example: