THE "PAPER COMPUTER" – A PEDAGOGICAL ACTIVITY
FOR THE INTRODUCTION OF BASIC CONCEPTS OF COMPUTERS
Valdemar W.Setzer
Dept. of Computer Science, University of São Paulo,
Brazil
www.ime.usp.br/~vwsetzer
Version 1.2- Dec. 3, 2005
1. Introduction
One of the basic goals of education is providing an understanding of the world, in particular of modern technology. Without this understanding, it is not possible to put machines in their proper context, using them only when they are beneficial and not detrimental to humanity and the environment. Moreover, a lack of understanding of the basic principles that regulate the functioning of machines produces what I like to call "a mental paralysis": the lack of curiosity and investigation which are so proper of humans (who are in constant search for conscious knowledge and understanding). This lack diminishes our humane condition. How many people know the principles of combustion motors, of air lifting of airplanes, etc.? Technology has become so sophisticated and hidden from the eyes and touching – mainly when it is hidden behind integrated circuits –, that people have become used to avoid asking the fundamental question: "How does this machine work?"
The computer represents the utmost in modern technology, as far as the general public is concerned. So I consider it absolutely essential that schools provide the teaching leading to the understanding of its functioning principles. I had the opportunity of expressing the point of view that computers should only be used by children after puberty (1). In (2) I extended those ideas and proposed a high school curriculum which begins with laboratory activities, introducing the basics of digital circuits using relays (which are of easy understanding), then transistors (whose basic "relay" properties may also be deducted from simple experiments). Only after this, notions of programming language and algorithms are taught, followed by general application software (specially advanced topics) and the Internet. Many Waldorf schools around the world use a similar approach, recognizing the importance of teaching the functioning of computers and programming languages before entering into teaching their use through text editors, spreadsheets, databases, graphics and the Internet. But there is a gap in their approach: there is no transition between the classes or labs on digital circuits and learning what programming languages are. I propose here practical activities filling precisely this gap. What is missing is the teaching of Machine Language, the basic code interpreted by any computer (every type of computer has its own machine language), its basic components and how the computer performs that interpretation. It is through a machine language that the student learns basic and fundamental concepts such as stored program, address, the difference between instructions and data, conditional and unconditional jumps, registers, CPU, arithmetic unit, etc.
I have a large experience with this approach. At the University of São Paulo, since the beginning of the 60’s computing was taught (at first in the beginning of a 2-semester course on Numerical Analysis, then as a one-semester course on programming) starting with machine language, and then going into the so-called "high-level" programming languages (FORTRAN, at that time, then ALGOL at the and of the 60’s, and Pascal or C – I don’t agree with using C for a beginner’s course – since the 70’s). Until 1968, the computer used for this teaching was an IBM 1620, which had a simple, decimal machine language. Then, the introduction of the minicomputer IBM-1130 and a (then) medium-size computer (Burroughs 3500) with binary and complicated machine languages respectively, made it impossible to use a real machine for that teaching. So I devised a hypothetical computer, which I called HIPO (from "computador HIPOtético, in Portuguese), which was simulated in those and further mainframes which were installed later. HIPO, a fixed-word decimal machine, was used in the beginning of every course in introductory computer science; the first 2 programming homeworks done by the students were precisely a program in machine language and another in the HIPO assembly language, which was also implemented. Furthermore, HIPO was also used in my course on compiler construction, as the target language.
In 1976 I had the idea of introducing a visual activity to teach the basic notions of the internal structure of a computer through its machine language. I devised the "Paper Computer", which is a sort of theater play where the actors are students, simulating every device of the HIPO machine. Contrary to the latter, the instructions were not coded but written in extensive text for easy and immediate understanding. The activity, which takes 2 hours, uses about 20 students, who perform at the front of the class, so all other students may follow what is happening and give suggestions.
The impression students get from this activity is very strong, and is kept in their conscious memory for a long time. In fact, when I taught those introductory courses, I used to refer very frequently to the images they saw during the Paper Computer play, when some concept could be better understood in terms of machine language. For instance, the notion of a "variable" in a "high-level" language (corresponding to one storage word of the HIPO machine), or a sequence of commands necessary to exchange the values of two "variables" can be only be well explained and understood in terms of a machine language.
After the Paper Computer play, a class dedicated to the introduction of HIPO is given. The text-instructions of the former are simply coded into the HIPO decimal instruction codes and format (each storage word uses a + or – sign and 4 digits). Then students proceed to a lab to test and do slight modifications of given programs using the HIPO simulator on a PC.
I describe here the Paper Computer play. In another paper (3), I describe the structure and functioning of the HIPO machine. Its simulator may be dowloaded from my web site (4).
2. Setting the Paper Computer
The paper computer is "assembled" with about 20 students, who are called to the front of the class. Each one receives a piece of carton about 20x10 cmwith a string attached to it, so it may be hanged in each student’s neck, at the height of the student’s breast. 15 students will perform the role of storage positions and receive cartons where the addresses 01, 02 up to 15, 30, 40 and 45 are written. Furthermore, a student receives a similar carton where the word CPU is written (it would be very useful if the instructor observes the students when they enter this class if it is the first one, or in previous classes, in order to assign the CPU to the most extrovert student). This student receives a piece of chalk and an eraser. Another student (a girl if the CPU is a boy, a boy otherwise) receives a carton written ACCUMULATOR. This student should have a string fastened to her/his waist, and the other end of the string fastened to the CPU student, such that a distance of about 1.5 m is left between both. The idea is that the accumulator is a part of the CPU, so wherever the CPU goes, the accumulator has to follow, which creates some funny situations. Three other students receive a similar carton with the following words: INSTRUCTION POINTER, KEYBOARD and PRINTER. The last two students sit on desks set in front of the class; all other stand, with those playing the storage positions next to each other, in ascending address order from left to right. Students performing storage positions 40 and 45, and the accumulator receive another piece of blank carton. They are supposed to hold this carton with their hands just below the address carton hanging from their neck, so that everybody can see them. The latter cartons should be dark-colored (for instance, dark blue or gray, or black), so that it is possible for the student performing the CPU role to write on them with white chalk (another possibility would be to use white cartons and writing with dark colored chalks). It is also nice to previously draw with ink in the last 3 cartons 5 boxes where a sign (+ or –) and 4 decimal digits will be later written (by the CPU student). An extra student should perform the role of the USER, who should act as a normal person, thus should have no carton with his role. He will start the computer and enter numbers into the "keyboard"; for this, it would be nice to have a real keyboard where the user will punch the numbers as described in section 4.
3. Loading the program
The instructor tells the students that the computer is now ready, and a program should be "miraculously" loaded into it. He then gives the students playing storage positions 01 to 15 cartons where the following instructions are written (Acc stands for "Accumulator"; [Acc] stands for "the contents of the accumulator"; [n] stands for "the contents of storage position n"):
Storage position |
Instruction |
01 |
Load the Acc with [30] |
02 |
Store [Acc] into 40 |
03 |
Input a number and store into 45 |
04 |
Print numerically [45] |
05 |
Load the Acc with [45] |
06 |
If [Acc]<0 then jump to 11 |
07 |
Load the Acc with [40] |
08 |
Add to the Acc [45] |
09 |
Store [Acc] into 40 |
10 |
Jump unconditionally to 03 |
11 |
Print numerically [40] |
12 |
Stop |
Furthermore, the student playing storage position 30 receives a carton (similar to the one given to the accumulator) where +0000 is written. This is used to initialize the result of the summation (stored at position 40) performed by the program – but the instructor should not tell the students about it or what the program does (adding a sequence of positive or null input numbers until a negative number is read, then printing the addition). I also recommend that no special explanations be given at this moment, for instance on how to read the notation [30].
4. Executing the program
The instructor tells that the computer is ready to begin its functioning. He tells the CPU that when he/she receives a kick (or maybe a twist of his/her ear, "switching on" the "machine") from the USER, he should start performing. The first thing the CPU does is to move the instruction pointer student to the front of storage position 01 student, and lift the instruction pointer’s arm and finger, so that the latter points to student 01. Ideally, the instruction pointer should be always pointing to some storage position (the instructor has to pay attention to that).
Then the instructor tells the CPU student to read aloud the instruction being held by the student performing the storage position pointed to by the instruction pointer. At this moment the instructor tells the CPU student and the class how instructions should be read, that is, the meaning of [30] and [Acc], as well as an address such as 40: "Load into the accumulator the contents of the storage position 30," "Store the contents of the accumulator into storage position 40" and so on. The instructor should write on the blackboard the interpretation to Acc, [Acc] and [n], as given in section 3.
The instructor then tells the CPU that to execute a program, the following rules should be applied in sequence:
1) Read the instruction being held by the student being pointed to by the instruction pointer, and memorize it.
2) Move the instruction pointer to the next storage position.
3) Execute the instruction.
4) Return to step 1.
He writes these rules at the blackboard (or exhibits and hangs a flip chart with them). Note that the order of the rules is correct, as will be explained in section 4, but this should not be mentioned to the students.
The CPU executes the first instruction in the following way. First he/she goes to storage position 30, reads aloud its content ("+, 0, 0, 0, 0"), then turns to the accumulator, passes the eraser over the carton being held by the latter (even if there is nothing written on it) and writes on it the symbols read at position 30, that is, +0000.
It is important to emphasize to the class that the CPU can only memorize the contents of the accumulator or of some storage position during the process of executing an instruction. After having executed it, those contents must be "forgotten." It is nice to ask in the middle of an execution the contents of the position or of the accumulator used in a previous instruction. The CPU invariably tells these contents, giving the instructor a chance of emphasizing the mentioned rule.
Then the instructor lets the CPU execute further instructions, telling how to perform new ones as they appear. For instance, the input instruction at 03 means that a number has to be given by the USER student. One way of doing this is having this student punch a number on a keyboard (always in the form sdddd, where s is either a + or – sign and d is a decimal digit, 0-9 – zeroes should always fill up the 4 digits if a number is less then 1000!). While he is punching, the KEYBOARD student should notice exactly what key is being punched, and should tell the CPU aloud (so that every student in the class may hear it) what sign or digit was punched. This simulates the "bus" between the keyboard ant the CPU. The CPU should memorize the entire input number, for example "+", "0", "2", "4", "3" and after the last digit is punched and told to the CPU, the whole number should be written into the carton being held by the student playing the storage position specified in the (input) instruction (To do this, the CPU erases whatever was written in the carton.
The instructor may tell the students that to simulate a real computer, when the user punches an entire number it should be stored by the keyboard unit in an internal buffer, which gives it to the CPU at the first step of the execution of an input instruction. But in the play it will be easier if the user punches his number precisely when the CPU begins the execution of an input instruction and the keyboard tells the sign and each digit to the CPU without memorizing them. It is also nice to suddenly ask the keyboard student what was the last number she has given the CPU; invariably the former tells that number, but the instructor should tell that in this set-up, the keyboard has no memory at all.
Coordinated by Roberto Hirata, the students who implemented the HIPO machine, and applied many times my Paper Computer play in a one-day introductory course to senior high school students which I had organized (4), also implemented a special program to help the input instruction. An IBM-PC was programmed to accept the input through the keyboard forcing the HIPO format (a sign plus 4 decimal digits), and display it on the screen. The CPU student would read it from the screen, and all students could follow because the computer screen contents was also projected on a large screen.
The execution of the conditional jump instruction at position 06 should be carefully e xplained. The CPU reads the contents of the accumulator (sometimes the student forgets to read it, and tells its contents by heart; it is a good opportunity for emphasizing that the CPU has no storage to remember what it read during the execution of previous instructions), sees if it has a – sign and is different from zero (0000), and if so moves the instruction pointer to the address specified in the instruction (11, in this case).
After explaining the unconditional jump instruction at position 10, maybe it would be nice to call the students’ attention to the fact that if rules 2 and 3 above would have been exchanged, the jump would be made to one instruction after the one referred to by the jump instruction. One way of maintaining this exchange would be to jump always to the previous address than the one desired. This explanation could be left for a later stage, after the students have deduced what the program does, thus showing understanding for the basic functioning principles of the Paper Computer.
The print instruction at position 11 is performed by the CPU by reading aloud the contents of the address specified by the instruction, that is, 03, and then telling it to the student performing the role of the printer. Then the latter should write the number in a piece of paper, always following the sign plus 4 digits format. The next number to be printed should be written below the previous one, and so on. The whole class should see the numbers printed, so one idea is to make the printer write the output on a part of the blackboard or on a flip chart. Again, here the instructor could suddenly ask the CPU "what number did you print?" showing that the CPU cannot memorize what he/she has previously done (neither can read what is in the output at the blackboard!).
When executed, the stop instruction at position 12 should put the CPU in a waiting state. Only if the user kicks it (or twists his/her ear) the CPU starts working again, as described in the beginning of this section.
5. Reaching the solution and suggesting variations
As mentioned before, it is very important for the instructor letting the students deduce by themselves what the program does. It is my experience that after 2 or 3 cycles students notice that storage position 40 is holding the summation of the input numbers. If this does not happen, the instructor should tell the user to punch a negative number, and see what happens. As the addition appears in the output produced by the printer, below the input numbers, in general students notice at this point what the program is doing.
The instructor may proceed to use the paper computer set-up to suggest some variations of the program or the setting. For example, what would happen if the user would stop punching new numbers? (The CPU would keep trying to receive data and would stuck.) Or, what would happen if there comes no negative number in the input? What would happen if the conditional jump instruction would be replaced by an unconditional one? And so on.
After that, the instructor may dismiss the students that took part in the play, and then describe what they have learned, correlating the various concepts with real computers. For instance, why did every instruction had only one address? (Two and three-addresses computers were built and are still in use, but a one-address computer is much simpler.) He could also call the attention to the important concepts learned: stored program, address, instruction, jumps, accumulator, CPU, how would disk storage devices work, how programs are loaded into central storage, etc. (I don’t like the word "memory," simply because nobody knows how our memory works, but we know precisely how a computer storage works; any association between both is scientifically undue.)
I used the word "accumulator" – the register where the result of an arithmetic operation is held, and which also contains one to the terms of that operation, thus making it possible to have single-address instructions – because in the beginning of binary machines, the accumulator was the only register coupled to the arithmetic unit. Later on, index registers (for storing storage addresses, permitting indirect addressing) were introduced, and then multiple registers that could function both as accumulators or terms for arithmetic operations, as well as index registers. But there is no sense in mentioning index registers at this level; ideally, this should be done while teaching the use of arrays in the "high-level" programming language course. I recommend just mentioning that today computers have multiple accumulators (so they have to be referred by the instructions, contrary to the Paper Computer) that are called "registers." Usually, our Instruction Pointer is called "Instruction Counter." This is based upon the fact that it is a simple arithmetic unit for itself, being able to just increment a storage address by 1 to move to the next storage position. I chose the former name because it represents better the purpose of that register.
After this class, there should be one where the Paper Computer instructions are coded into the HIPO instruction format, using a 2-digit decimal code which is written in the leftmost digits of a storage position. Thus, each storage position would hold a sign and a 4-digit number, which may be interpreted by the CPU as an instruction referring to a single storage address or a signed numeric piece of data. Then the notion of alphanumeric coding may be introduced (2 digits for each character, that is, 2 characters per word) as well as floating point notation (the leftmost two digits representing the exponent of 10 in an "excess-50" notation, the rightmost 2 or with an additional word representing the mantissa. But these are topics for the class on the HIPO machine (see my web site for the correspondent paper and the HIPO simulator).
6. Conclusions
It is my experience that students like this class very much, because it is not purely directed to their intellect. If a very extrovert student is chosen for the CPU role, then there will be lots of fun. Watching the functioning of the Paper Computer (a joke is that this is the real interpretation for "PC"…) leaves a very strong impression in the student’s memory. I have also applied this play with adults, also with great success.
When I taught an introductory course in programming, I used to show the students how every command of a high-level language could be translated into the HIPO machine, so that they would understand how the computer performs statements such as "if…then…else…", "while…do…", etc. During these classes, I would make reference to the students that performed each role in the play, like "Peter, the CPU…".
The concepts of the paper computer and its coded machine may be used, for instance, when teaching what a text editor is. After a line with a fixed number of characters, a storage position would come with an address pointing to the beginning of the next line (forming a linked list), so it is very easy to insert or eliminate lines. This way, at least some basic functioning of application software may be introduced. We would be educating people to understand what the machines they are using do, and could show that there is no mystery behind them. When introducing electronic spreadsheets, it is easy to show that the contents of a cell may in fact be just an address to a storage position containing a value or the beginning of a formula. In a formula, the external coordinate notation may be translated into the address of the contents of the cell.
Furthermore, the paper computer and the coded machine may be used to call the attention to relevant restrictions imposed by computers, as the fact that they are deterministic, condemned to the executions of their programs, that computers don’t make decisions, but follow logical choices, that everything inside a computer must be quantified, etc. I think that every new knowledge on technology being taught should always be followed by a criticism on its restrictions and the behavior it forces upon the user. In the case of computers, this is clear: when a general user is giving a command to the machine or a programmer is developing programs, they have to exercise a very restricted class of thoughts, in fact thoughts that can be inserted and correctly interpreted by the computer. This "machine-thinking" must be compensated by intuitive thinking such as that exercised when doing some artistic activity, which I consider the correct antidote to excess of "machine-thinking" (5).
References
(1) Setzer, V.W. Computers in Education. Edinburgh: Floris Books, 1989. See also its extended version, Computer in der Schule? Thesen und Argumente. Stuttgart: Verlag Freies Geistesleben, 1992.
(2) Setzer, V.W and Monke, L. "Challenging the Applications: An Alternative View on Why, When and How Computers Should Be Used in Education," in Muffoletto, R. (Ed.), Education and Technology: Critical and Reflective Practices. Cresskill, New Jersey: Hampton Press, 2001, pp. 141-172. Also available at my web site.
(3) Setzer, V.W. and R.Hirata Jr. HIPO-PC: an educational software for the introducing computers (in Portuguese). Technical Report RT-MAC-8809. São Paulo: Department of Computer Science, University of São Paulo, 1988.
(4) Setzer, V.W. and R. Hirata Jr. The Computer Day – a short introduction to computers and computing (in Portuguese). Caderno da Revista do Professor de Matemática, Brazilian Mathematical Soiety, São Paulo, Vol. 4, No. 1, 1993.
(5) Setzer, V.W. An antidote to computer-thinking. Available at my web site.