Chapter
1

Pygmalion:
An Executable Electronic Blackboard

David Canfield Smith

Introduction

Pygmalion was an early attempt to change the process of programming from one in which algorithms are described abstractly in a programming language to one in which they are demonstrated concretely to the machine. It introduced two new concepts: programming by demonstration and icons. Icons have become widely accepted. Programming by demonstration is still waiting for a practical system to show its validity. Pygmalion was completed in 1975. This chapter is a commentary on that work.

Human-Computer Communication

Traditionally people instruct computers by sitting down with a pad of paper (or a window for a text editor) and writing a sequence of statements in some programming language. They then compile the statements, link the resulting machine code with other run-time routines, and attempt to execute it. There are almost always errors. At this point programmers enter the debug-edit-recompile loop. They track down bugs using whatever means are available, edit the source text of their programs, recompile it, relink it, and reexecute it. There are almost always more errors. In fact, fixing a bug often introduces new bugs. This debug-edit-recompile loop can consume the majority of time spent on a program. And no one claims anymore that all bugs can be removed from any large program.

Writing static language statements interspersed with compile-run-debug-edit periods is obviously a poor way to communicate. Suppose two humans tried to interact this way! Specifically, it is poor because it is:

(a) Abstract

The programmer must mentally construct a model of the state of the machine when the program will execute, and then write statements dealing with that imagined state. In practice, for a program of any complexity this is impossible. People cannot handle as much complexity as computers can. A typical symptom of this is boundary errors: an unanticipated value is used in an operation, resulting in an error. Dividing by zero is a classic example. We must find a way to allow programmers to work with concrete values without sacrificing generality.

(b) Non-interactive

The debug-edit-recompile loop takes a lot of time per bug fix, particularly as programs get large. This low productivity has led programmers to seek faster machines and compilers. But that misses the point. Instead of speeding up the debug-edit-recompile loop, programmers should eliminate it! A few programming languages such as Lisp and Smalltalk are in fact interactive. One can type in an expression and immediately get it evaluated and see the result. Such languages are more productive than non-interactive languages.

So why aren't interactive languages more widely used? Most are high level languages that are not as efficient as low level ones such as C and FORTRAN. In their search of a competitive advantage, software developers want their programs to execute as fast as possible, even at the expense of a longer development time. But this situation may be changing. Computers are now fast enough that interactive languages are practical in some cases. Several commercial applications have been written in Lisp, and IBM now recommends Smalltalk for developing applications under its OS/2 operating system. Even some versions of C now contain an interpreter for quick development and debugging.

(c) "Fregean"

The most articulate representation for a program requires the least translation between the internal representation in the mind and the external representation in the medium. Aaron Sloman [Sloman 71] distinguishes two kinds of data representations: "analogical" and "Fregean" (after Gottlob Frege, the inventor of the predicate calculus). Analogical representations are similar in structure to the things they describe; Fregean representations have no such similarity. Consider the following examples:


One of the advantages of analogical representations over Fregean ones is that structures and actions in a context using analogical representations (a "metaphorical" context) have a functional similarity to structures and actions in the context being modeled. One can discover relationships in a metaphorical context that are valid in the other context. For example, there are five items in array A; triangles have three sides; bicycles have two wheels; Texas is in the south. Analogical representations suggest operations to try, and it is likely that operations applied to analogical representations would be legal in the other context, and vice versa. This is the philosophical basis for the design of the Xerox Star and, ultimately, Apple Macintosh "desktop" user interfaces; they are a metaphor for the physical office [Smith 82]. Being able to put documents in folders in a physical office suggests that one ought to be able to put document icons in folder icons in the computer "desktop," and in fact one can.

Jerome Bruner, in his pioneering work on education [Bruner 66], identified three ways of thinking, or "mentalities":

But Bruner argues that it is a mistake for schools to force children to abandon their enactive and iconic thinking skills when learning the symbolic. All three mentalities are valuable at different times and can often be combined to solve problems. All three skills should be preserved.

Jacques Hadamard, in a survey of mathematicians [Hadamard 45], found that many mathematicians and physicists think visually and reduce their thoughts to words only reluctantly to communicate with other people. Albert Einstein, for example, said that "The words of the language, as they are written or spoken, do not seem to play any role in my mechanism of thought. The psychical entities which seem to serve as elements in thought are certain signs and more or less clear images which can be `voluntarily' reproduced and combined.... This combinatory play seems to be the essential feature in productive thought--before there is any connection with logical construction in words or other kinds of signs which can be communicated to others.... The above mentioned elements are, in my case, of visual and some of muscular type. Conventional words or other signs have to be sought for laboriously only in a secondary stage, when the mentioned associative play is sufficiently established and can be reproduced at will." [Hadamard 45, pp.142-3]

Some things are difficult to represent analogically, such as "yesterday" or "a variable-length array." But for concepts for which they are appropriate, analogical representations provide an intuitively natural paradigm for problem solving, especially for children, computer novices, and other ordinary people. And a convincing body of literature suggests that analogical representations, especially visual images, are a productive medium for creative thought [Arnheim 71].

Words are Fregean. Yet words and rather primitive data structures are often the only tools available to programmers for solving problems on computers. This leads to a translation gap between the programmer's mental model of a subject and what the computer can accept. I believe that misunderstanding the value of analogical representations is the reason that almost all so-called visual programming languages, such as Prograph, fail to provide an improvement in expressivity over linear languages. Even in these visual languages, the representation of data is Fregean.

With the advent of object-oriented programming, the data structures available have become semantically richer. Yet most objects are still Fregean. A programmer must still figure out how to map, say, a fish into instance variables and methods, which have nothing structurally to do with fish.

(d) "Blank canvas" syndrome

Pablo Picasso said "the most awful thing for a painter is the white canvas." One of his most memorable paintings, "The Studio at Cannes," is of his own studio. Its walls and ceiling are covered with paintings. Priceless works of art are jumbled together everywhere. But right in the middle of the room stands an easel holding a blank canvas. This is a fitting image of the problem facing all creative people: how to get started. A blank coding pad is as much a barrier to programming creativity as a blank canvas is to a painter.

What's needed is a lightweight, non-threatening medium like the back of a napkin, wherein one can sketch and play with ideas. The computer program described in the remainder of this chapter, Pygmalion, was an attempt to provide such a medium. Pygmalion was an attempt to allow people to use their enactive and iconic mentalities along with the symbolic in solving problems.

Pygmalion

In Roman mythology, Pygmalion was a sculptor of extraordinary skill. At the peak of his powers, he determined to create a masterwork, a statue of a woman so perfect that it would live. The statue, which he named Galatea, was indeed beautiful, but alas it remained just stone. Heartbroken, he prayed to the gods. Venus, impressed with his work and passion, took pity on him and brought the statue to life. (They could do that back then.)

This urge to create something living is common among artists. Michelangelo is said to have struck with his mallet the knee of perhaps the most beautiful statue ever made, the Pieta, when it would not speak to him. And then there's the story of Frankenstein. Artists have consistently reported an exhilaration during the act of creation, followed by depression when the work is completed. "For it is then that the painter realizes that it is only a picture he is painting. Until then he had almost dared to hope that the picture might spring to life." (Lucien Freud, in [Gombrich 60], p.94) This is also the lure of programming, except that unlike other forms of art, computer programs do "come to life" in a sense.

The Pygmalion described in this chapter is a computer program that was designed to stimulate creative thinking in people [Smith 75]. Its design was based on the observation that for some people blackboards (or whiteboards these days) provide significant aid to communication. If you put two scientists together in a room, there had better be a blackboard in it or they will have trouble communicating. If there is one, they will immediately go to it and begin sketching ideas. Their sketches often contribute as much to the conversation as their words and gestures. Why can't people communicate with computers in the same way?

Pygmalion is a two-dimensional, visual programming environment implemented on an interactive computer with graphics display. (Although this work was completed nearly two decades ago, I will describe it in the present tense for readability.) It is both a programming language and a medium for experimenting with ideas. Communication between human and computer is by means of visual entities called "icons," subsuming the notions of variable, data structure, function and picture. Icons are sketched on the display screen. The heart of the system is an interactive "remembering" editor for icons, which both executes operations and records them for later reexecution. The display screen is viewed as a picture to be edited. Programming consists of creating a sequence of display images, the last of which contains the desired information. Display images are modified by graphical editing operations.

In the Pygmalion approach, a programmer sees and thinks about a program as a series of screen images or snapshots, like the frames of a movie. One starts with an image representing the initial state and transforms each image into the next by editing it to produce a new image. The programmer continues to edit until the desired picture appears. When one watches a program execute, it is similar to watching a movie. The difference is that, depending on the inputs, Pygmalion movies may change every time they are played. One feature that I didn't implement but wish I had is the ability to play movies both backward and forward; then one could step a program backward from a bug to find where it went wrong.

There are two key characteristics of the Pygmalion approach to programming.

Today we recognize these as being good user interface principles that most personal computer applications heed. So one way to characterize Pygmalion is to say that it attempted to bring good user interface principles to the process of programming, not just to the result of programming.

Another early attempt to specify programming by editing was Gael Curry's Programming by Abstract Demonstration [Curry 78]. It was similar to Pygmalion, except that instead of dealing with concrete values, Curry manipulated abstract symbolic representations (e.g. "n") for data. While this made some things easier to program than in Pygmalion, it is interesting to note that in his thesis he reported making exactly the kinds of boundary errors mentioned above because he could not see actual values.



Pygmalion

Uses and Users

Application domain: Custom graphical programming environment

Intended users: Programmers

User Interaction

How does the user create, execute and modify programs?
The user creates programs by editing graphical snapshots of the computation. Essentially the user treats the display screen as an "electronic blackboard", using it to work out algorithms on specific concrete examples.
Pygmalion provides graphical representations for the standard arithmetic, relational, and Boolean operators.
Partially specified programs could be executed. The system asks the user what to do next when it reaches the end of a branch.
Programs can be modified, but then the rest of the modified branch must be re-demonstrated.

Inference

Inferencing: No inferencing

Types of examples: Multiple examples to demonstrate branches of a conditional, and recursion.

Program constructs: Variables, loops, conditionals, recursion

Implementation

Machine, language, size, date: Smalltalk, 1975.


back to ... Table of Contents Watch What I Do