Parameter Lists

[The inspiration for this one comes both from the author of "Comic Pascal", Helmut Zwittlinger, as well as the German word for this concept, "Parameterleiste" since I use a wooden slat = Leiste for constructing it,]

You take a long slat and hammer some nails into it, about 15 cm apart. Now take some simple variables and attach lids to them using string so they don't get lost. The variables need to have extra holes in them to hang on the slat.

The scenario: "A procedure is described by giving its name and the number, name and type of its parameters".

Take a post-it and write the name of the procedure on it and stick this on one end of the slat. Prepare the variables for the students explaining as you go. After making the integer variable, close the lid before hanging it on the slat. This is a call-by-value parameter, the value goes into the container and is sealed, after returning from the call we will not be able to see if any changes were made. The other variable (this was a drinking joughrt box, and the value was a straw, which has disappeared) does have a lid, but this is not closed. It is a call-by-reference parameter, both the caller and the callee (after the return) can get in to access the value.

A photo of one of the lists is available.


Debora Weber-Wulff <weberwu@htw-berlin.de>
Letzte Änderung: Thu Jun 3 14:06:03 1999