"Watch What I Do" Chapter 15



Figure 1. A Chimera editor window (top), and its graphical history window (below) showing steps that added text to an oval and created a drop shadow in the scene above. Panels with labels shown in reverse video have been selected by the user to create the macro of Figure 2.

Chapter
15

A History-Based Macro by Example System

David Kurlander
and
Steven Feiner

Introduction

When applications are made extensible, the entire user community benefits. Individuals can customize their applications to the tasks that they often encounter, and experts can encapsulate their expertise in a form that less skilled users can exploit. By writing a macro or program, users can extend an application to perform tasks not included in the original interface; however this typically requires both programming skills and familiarity with the application's extension language. Systems with a macro by example or programming by demonstration component generate code automatically in response to tasks demonstrated by the user through the application's own interface. These systems make the benefits of extensibility accessible to the entire user community.

Many applications, such as GNU Emacs [Stallman 87], have a macro by example facility, but lack a visual representation for the macros. Without a visual representation, it is impossible to review the operations that compose the macro. When there is an error in such a macro, the macro must be demonstrated once again from scratch. If an error occurs in a macro without a visual representation, the system cannot provide a comprehensible error message explaining which step generated the error.

Though visual representations are clearly important for a macro by example facility, many systems omit this component since it is problematic how to statically display commands executed through an application's graphical user interface. We have developed a technique for visually representing such commands. Previously we used a representation, called editable graphical histories, to provide a visual record of commands executed in a session with a graphical editor (Chapter 19). We have extended this technique to represent macros by example, and support the definition and editing of these macros. Here we introduce a macro by example facility that uses editable graphical histories as its visual representation, and discuss the many ways that the macro facility takes advantage of these histories.

The macro by example system described in this paper is implemented as part of Chimera, an editor system with modes for editing 2D illustrations, user interfaces, and text (Chapter 12). Macros can currently be defined in both the illustration and user interface editing modes. All of the examples in this paper are generated from the PostScript output of Chimera and its macro by example facility.

In the next section we discuss how other example-based systems have dealt with the issue of representation. Then we briefly describe editable graphical histories, and in the rest of the paper focus on how they support a macro by example facility.



Chimera --
History-Based Macros by Example

Uses and Users

Application domain: Graphical editing and interface editing

Intended users: End users

User Interaction

How does the user create, execute and modify programs? The user demonstrates a task in the regular user interface. Then the user selects a sequence of commands from the graphical history and selects arguments. Chimera generalizes the sequence into a macro. Feedback about capabilities and inferences: For its visual representation of macros, Chimera uses editable graphical histories. In this representation, the effects of executing commands are distributed over a set of panels, as in a comic strip. Inferred generalizations of these commands are expressed textually in a dialog box for each panel. The user can change the generalizations by editing these dialog boxes.

Inference

Program constructs: Procedure calls with any number of arguments. Arguments can be graphical objects, properties (such as a color or line width), or measurements (distance, angle, or slope). Chimera cannot infer loops or conditionals (although graphical search can be explicitly invoked, providing one class of iteration).

Knowledge

Types and sources of information:
For each editor command, there is information about possible generalizations of that command, and heuristics for determining their likelihood.

Implementation

Machine, language, size, date: Chimera runs on Sun Sparcstations, under the PostScript-based OpenWindows window system. The code is a mix of Common Lisp (25K lines), C (3K lines), and PostScript (2K lines). Of this, the code for drawing the editable graphical histories is about 2K lines of Lisp, and the code for generating macros is another 2K lines. 1991.

Notable Features

The editable graphical history representation supports several steps of the macro definition process: selecting macro operations, editing the macro, declaring arguments, reviewing the macro, and understanding error messages.


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