Learning With Computers
Teaching Johnny To Program
Teaching Tools: Microcomputer Services
Palo Alto, CA
I expect within the next few years someone will write a book charging many schools with a misguided approach to teaching children about computer programming. This book, probably entitled Why Johnny Can't Program, will claim that teaching LOGO is the only proper approach, and that teaching BASIC is almost evil. Such extreme claims have already been made. For example, Seymour Papert, a leading advocate of LOGO, has written in Mindstorms: Children, Computers and Powerful Ideas:
[It is] as unacceptable for children to enter the computer culture by learning computer languages such as BASIC as it would be to confine their access to English poetry to pidgin English translations (p. 211).
BASIC is the standard language for all personal computers. LOGO is a newer language, available for Apple II and TI 99/4 computers and being developed for several others. The advocates of LOGO claim it should, and will, replace BASIC — especially for teaching children. In order to evaluate this claim, we first must consider what features we want in a computer language taught to children.
What Children Need
- The language should make small but interesting programs easy to write. This is useful for motivating students and alleviating anxieties about programming.
- The language should make it easy to debug programs. Beginners quickly realize the need for exactness in programming but have trouble getting all the details right. Clear error messages and other features that facilitate debugging prevent a lot of frustration in teaching and learning.
- The language should be designed for working with pictures and words. Most people, particularly young people, would rather use computers to create pictures and dialogues than to solve mathematical problems.
- Learning the language should provide a good basis for learning more advanced programming. The students should master concepts common to all computer languages and develop good programming techniques.
- The language should be compatible with the ways children think, and working with the language should facilitate the development of general thinking skills.
Comparing BASIC and LOGO
Now that we have some criteria, how do BASIC and LOGO compare?
Ease of getting started. BASIC and LOGO were both designed with novice programmers in mind. In either language, you can write small programs with a few simple commands. The programs will be of different types. A typical first BASIC program performs simple mathematical operations such as converting between centigrade and fahrenheit degrees. A typical first LOGO program creates shapes such as squares and triangles.
Ease of debugging. BASIC and LOGO are both interactive or conversational languages. When using an interactive language, you can get immediate responses from the computer without having to go through any other steps (such as the compiling step required with many languages). This makes it easier to find and correct errors in programs. With either BASIC or LOGO you can stop a program at any time, ask the computer questions such as the values of variables, and then continue the program from where it was stopped. The two languages also give helpful information about exactly where errors occur.
Working with pictures. LOGO contains an excellent Turtle Graphics system which makes it easy to create pictures. The child commands a "turtle" marker to move and draw on the screen. The commands include move forward or backward a number of steps, turn left or right a number of degrees, select a pen of a specified color, and raise or lower the pen to control whether the turtle draws as it moves. Here is a simple program to draw a square:
TO SQUARE FORWARD 40 RIGHT 90 FORWARD 40 RIGHT 90 FORWARD 40 RIGHT 90 FORWARD 40 RIGHT 90 END
This program can be condensed to:
TO SQUARE REPEAT 4 [FORWARD 40 RIGHT 90] END
Turtle graphics, originally developed as part of LOGO, has since been incorporated into other languages, including Atari PILOT which I will review in next month's column. See Dave Thornburg's Friends of the Turtle column for more examples of turtle graphics.
BASIC typically uses a coordinate graphic system in which you specify the horizontal and vertical locations of things to appear on the screen. Here is a BASIC program to draw a square:
100 DRAW 0, 0 TO 40, 0 110 DRAW 40, 0 TO 40, 40 120 DRAW 40, 40 TO 0, 40 130 DRAW 0, 40 TO 0, 0
Each DRAW command draws a line between the coordinates specified.
There are many dialects of BASIC. In some the graphic commands are limited to plotting points and drawing lines. Others, such as the Radio Shack Color Computer Extended BASIC and the IBM Personal Computer BASIC, include more powerful graphic commands for drawing circles, arcs and boxes, filling areas with color, and moving pictures on the screen to create animations. The ease of creating pictures in BASIC depends to a large extent on which version is used.
Working with words. In BASIC, sets of letters are grouped together to form strings. Commands are available for testing whether strings match, for combining strings and for selecting parts of strings.
In LOGO, letters combine to form words, which are analogous to strings in BASIC. In addition, LOGO has lists. A list consists of an ordered set of words or simpler lists. That is, you can have a list of lists, or a list of lists of lists, and so on. This is very useful for working with language – a list of words forms a sentence, a list of sentences forms a paragraph, and a list of paragraphs forms a discourse. LOGO contains procedures for checking whether a list contains a specified word, testing whether two lists match, combining lists and selecting parts of lists. The commands for working with language in LOGO are far more powerful than those in BASIC.
Learning general programming concepts. When learning either BASIC or LOGO, children become familiar with many concepts important in all programming. These concepts include variables, branching, iteration (repetition of sets of commands), conditionals (if/then decisions), and modules (subroutines or procedures). LOGO adds the concept of recursion (procedures that call themselves).
Learning good programming techniques. Programming techniques have advanced since BASIC was developed, and BASIC is often faulted for not encouraging good programming practices. As computers have become faster and memory less expensive, emphasis has shifted from writing programs which execute quickly and take little memory, to programs that are easy to write, understand, test, debug and modify.
An important part of good programming is dividing the overall goals of the program into simpler subgoals, each of which can be handled in its own part of the program. This is called modular programming. While modular programming is possible in BASIC, the language does not facilitate this approach.
LOGO was designed for modular programming. You define procedures, each of which tells the computer how to do something. Once a procedure is defined, it can be used in other procedures in exactly the same way as any of the "primitive" procedures built into the language. That is, each procedure you create can be used as a module in a larger program. For example, once the SQUARE procedure given above is created, it can be used in a procedure to create a more complex picture such as:
REPEAT 8 [SQUARE RIGHT 45]
Since a created procedure can be used just like a built-in one, LOGO lets you design your own language by creating a set of procedures to suit your purposes.
Compatibility with children's ways of thinking. Children are best able to understand things in terms of concrete images and their own actions, rather than in terms of abstract concepts. Turtle graphics therefore provides an excellent means of introducing programming to children. Commands to the turtle are in terms of processes children can act out. A child might create a SQUARE procedure by first drawing a square with a pencil and paper (or walking the shape of a square) and observing his own movements. The child can then tell the turtle how to follow the same pattern of movement. In contrast, the graphics commands typical of BASIC require an understanding of the coordinate system and do not reflect the processes of drawing.
While the turtle graphics component of LOGO suits children very well, I am less certain about the rest of LOGO. The commands for working with words are powerful but may not be simple for children to use. Most teachers using LOGO have so far focused on turtle graphics. I am waiting for more information from teachers and children who are exploring the non-graphics aspects of LOGO.
In BASIC, children generally find it easy to understand the individual string processing commands and to write small programs with them. However, the difficulty of BASIC programming increases rapidly as the size of the program increases.
Developing thinking skills. To program in any language, one must analyze the task the computer is to perform, divide it into sub-steps, carefully communicate the sub-steps to the computer, and test and debug the program. Many teachers report that when children learn programming they also acquire ways of approaching many types of problems and gain an appreciation of the need for careful work. This leads to improvements in much of their school work.
I believe the critical factor in whether learning to program facilitates general thinking skills is not which language is taught, but whether the teaching encourages careful task analysis, problem solving, and testing. However, LOGO does have some advantages over BASIC. Since it encourages modular programming, it also encourages careful analysis of problems and good programming practices. LOGO contains features well adapted to certain problem solving strategies (such as progressively reducing a problem to similar but simpler problems). And working with turtle graphics can lead children to an intuitive understanding of concepts of geometry and symmetry.
Which Language Should Children Be Taught?
More people know BASIC than any other computer language and there are a greater number of books and programs available to help teach BASIC. I know many children and adults who have gotten a great deal out of learning BASIC – knowledge about computers, an understanding of general concepts of programming, appreciation of the need for careful thinking and attention to details, and joy and pride in being able to control the computer with their own programs.
LOGO has been used in a number of test projects and is beginning to be tried in many classrooms. As I've discussed, it has several excellent features for teaching children, particularly in the turtle graphics component. I expect materials to help learn and teach LOGO will become available rapidly.
Children enjoy and benefit from learning either BASIC or LOGO. Why shouldn't they learn both?
Versions Of LOGO For Apple II Computers
Two versions of LOGO are now available for Apple computers, one developed at MIT and the other developed by Logo Computer Systems, Inc. (LCSI). LCSI LOGO is marketed by Apple through its dealers. Two companies market the MIT version: Terrapin Inc. (678 Massachusetts Ave. #205, Cambridge MA 02139), and Krell Software (21 Millbrook Drive, Stony Brook, NY 11790). Both versions require a 48K Apple II with a 16K RAM card (or language card) and one disk drive. The two versions have far more similarities than differences, but each has several features not found in the other.
The MIT version has three features which are particularly useful with children: (1) The ability to change the shape of the turtle. This is useful for animations – you can create your own shape and move it on the screen with turtle commands. (2) A trace function which lets you run a program step-by-step. This is useful for carefully analyzing programs and for finding bugs. (3) The ability to save pictures to disk and retrieve them from a program. MIT LOGO also has a feature for machine language programmers: it lets you add your own machine language routines.
LSCI LOGO, while not having the features mentioned above, has several features not found in the MIT version. These include more advanced list processing capabilities, convenient ways of working with sets of procedures, the ability to re-define primitive commands, and good error trapping capability. These features are particularly useful for advanced programmers.
An important part of a LOGO package is the documentation. LCSI LOGO comes with two manuals, an excellent turtle graphics tutorial and a good reference manual. Terrapin has its own tutorial, which covers both turtle graphics and language processing. I only have a draft available for review, but it looks like a very useable manual. Krell provides a minimal amount of written documentation and a tutorial on disk. The Krell tutorial is severely lacking – it demonstrates many of the capabilities of LOGO but does not teach anyone how to use them.
The prices of the three LOGO packages, with documentation and back-up copy, are: LCSI — $175; Terrapin — $165 ($150 + $15 for back-up disk); Krell — $179. I recommend either LCSI or Terrapin. Krell cannot be recommended due to the lack of adequate documentation.
Four books that tell you more about LOGO are available:
Logo by Harold Abelson (Byte/McGraw Hill Publishers, 1982). A guide to using LOGO which is a good addition to the LCSI and Terrapin manuals.
Special Technology for Special Children by Paul Goldenberg (University Park Press, 1979). Discusses uses of LOGO with severely handicapped children.
Mindstorms: Computers, Children and Powerful Ideas by Seymour Papert (Basic Books, 1980). The case for LOGO, strongly stated.
Turtle Geometry by Harold Abelson and Andrea diSessa (MIT Press, 1980). A technical book on using turtle graphics to teach concepts of plane geometry, vectors and topology and other areas.
An Inexpensive Turtle Graphics Program
Many people want to try turtle graphics without investing in the full package and the necessary memory expansion. An excellent program which lets you do so was published in Nibble magazine (Vol. 3, No. 1, 1982). This program, written in Applesoft by David Krathwohl, provides the main turtle graphics commands, the ability to write procedures and call them from other procedures, iteration, some minimal use of variables, and saving programs to disk. You can find a copy of the magazine and type the program into your Apple or order a disk (with documentation and two other programs) for $29.95 plus $1.50 postage from Nibble: Box 325, Lincoln MA 01773.