March 20, 2023


Empowering People

Programming by Example – Visual Interfaces

In the mid 1970s Smith introduced the technique of Programming by Example with a program called Pygmalion, Smith elaborated on this in Watch What I Do: Programming by Demonstration (Chapter 1). This demonstrated the need to describe algorithms through concrete examples rather than abstractly. ‘Example-based Programming: a pertinent visual approach for learning to program’ (Guibert et al, 2004) explain and expands on Smiths work with an example demonstrating how numbers fail to reveal the concept behind them. The example is a numerical representation of a triangle. This representation is ‘fregean’ because it does not show the concept of a triangle. Next to this is a diagram of the triangle that does show the concept. Next to this is a diagram of the triangle that does show the concept, this is referred to as ‘analogical’ representation because it includes the context of the information. Including the context of the information allows a person to discover meanings or relationships in the information which would not always be obvious. (Hanna, 2005) and (Elliott, 2006)provide an interface for direct manipulation of shapes in this analogical way by creating an interactive triangle manipulation example using the Haskell functional programming language.

Semantic web languages allow for the context of the information to be represented in documents and so make it possible to represent information in an analogical way, as well as allowing two way interaction, leading to an improvement in information discovery.

The development of visual user interfaces has been a major step forward. The use of pictorial metaphors such as folders to represent a collection of files has greatly aided human computer interaction. Pictorial metaphors give visual feedback so the user knows what the software system is doing. This technique can be used more dynamically in simulations. Simulations represent the real world problem and provide constant feedback to the user on how the system is progressing. In this sense, all software should be regarded as a simulation. Pictorial metaphors are static, while a users’ mental model is made up of mental images connected together by a set of rules. The user runs a mental model like a simulation. Static user interfaces rely on a user to string together images into a mental model which correctly represents what the system is doing. A user may generate a mental model in response to user interface metaphors which is inconsistent with the system model.

Simulation can help to ensure that the designers’ model, system model and users’ model are all the same. This subject is explored in [Crapo et al. 2000 and 2002] and is the basis of the visualisation techniques used to enable the user to create and understand models that are subsequently translated into software representations. This is also explained in chapter one of Watch What I Do: Programming by Demonstration [Cypher, 1993], explains how the Pygmalion language attempts to bridge the gap between the programmer’s mental model of a subject and what the computer can accept. The author of this system David Smith went on to develop office oriented icons as part of the Xerox’s “Star” computer project.

My research based on these ideas is available at

and my examples at


Smith, D. C., 1977. A Computer Program to Model and Stimulate Creative Thought. Basel: Birkhauser.

Smith, D. C., 1993. Pygmalion: An Executable Electronic Blackboard. In: A. Cypher, ed. Watch What I Do: Programming by Demonstration. MIT Press, Chapter 1 – ISBN:0262032139.

Guibert, N., Girard, P., Guittet, L., 2004. Example-based Programming: a pertinent visual approach for learning to program. Proceedings of the working conference on Advanced visual interfaces. pp 358-361 – ISBN:1-58113-867-9.

Hanna, K., 2005. A document-centered environment for Haskell. 17th International Workshop on Implementation and Application of Functional Languages IFL 2005 Dublin, Ireland – September 19-21 2005.

Elliott C., – Functional Programming by Interacting with Tangible Values – – Conal Elliott – April 8, 2006.

Crapo, A. W., Waisel, L. B., Wallace, W. A., Willemain, T. R., 2002. Visualization and Modelling for Intelligent Systems. In: C. T. Leondes, ed. Intelligent Systems: Technology and Applications, Volume I Implementation Techniques, 2002 pp 53-85.

Crapo, A. W., Waisel, L. B., Wallace, W. A., Willemain, T. R., 2000. Visualization and the process of modeling: a cognitive-theoretic view. Conference on Knowledge Discovery in Data – Proceedings of the sixth ACM SIGKDD international conference on Knowledge discovery and data mining pp 218-226.

Cypher, A., 1993. Watch What I Do Programming by Demonstration. MIT Press, Chapter 1 – ISBN:0262032139.