Chapter 1

1.1 Interactive Worksheets

Interactive worksheets are a simple but powerful way for people to manage "structured" data and to solve data-related problems. Examples of interactive worksheets range from simple, single-user spreadsheets (such as the interactive grids of cells in systems like Numbers and Excel) to collaborative, multi-institutional planning and design tools.

The power and popularity of interactive worksheets stem from a combination of features.

  1. Meaningful data display. Data is typically presented is presented on worksheets in forms suited to the type of data involved - as tables, charts, graphs, and so forth.

  2. Modifiability. Data can be directly modified by the user in what-you-see-is-what-you-get fashion. Importantly, data can be changed in whatever order suits the user.

  3. Constraint checking. Data is automatically checked for completeness and consistency with static and dynamic constraints. Users are alerted to problems; and, where possible, they are given guidance in eliminating those problems.

  4. Automatic computation of results. Consequences of acceptable changes are automatically computed, and the presentation is updated to reflect those consequences.

While these features can be used in many information management settings, they have special value in certain types of applications, e.g. configuration tasks (such as product configuration worksheets and academic program sheets), teaching (such as interactive exercises and simulated environments), online games (such as Chess, Checkers, Pentago), and so forth.

1.2 Example

As an example of an interactive worksheet implemented as a web page, take a look at the academic program sheet shown here. This worksheet provides a means for a student to design a program of study that achieves his academic goals and at the same time meets the academic requirements of his university.

The worksheet includes a listing of courses available to the student. At the bottom on the left, there is a pie chart indicating the proportion of his selected courses in various subareas of Computer Science. In the middle, there is an indication of the number of units of credit the student is requesting for each selected course. And, on the right, there is a listing of professors responsible for those courses.

The student can change his program by selecting courses in whatever order he likes. Clicking an empty checkbox adds the corresponding course to his program of study. Clicking a checkbox that is already checked removes the corresponding course from his program. (Try it.) Once a course is selected, the student can change the number of units of credit for each course by using the slider associated with that course.

An important part of the update process is constraint checking. As each change is made, the worksheet checks that all academic requirements are satisfied. If there is a violation, the corresponding requirement turns red, indicating that there is something wrong. Once the requirement is satisfied once again, the requirement turns black. (Try unchecking and checking some of the courses selected on the original worksheet. Try changing the number of credit units.)

As the program is modified, as changes are made, the worksheet is updated accordingly. For example, as each box is checked, it is added to the course list, and a photo of the associated professor appears. Moving the slider for a course changes the requested credit; and, as such changes are made, the pie chart automatically adjusts to show the portion of time the student is devoting to various subareas of the department.

This is a simple example, but it illustrates the key features of interactive worksheets - visibility of all relevant data, the ability to modify that data, automatic checking of constraints, and automatic calculation and display of consequences.

1.3 HTML Worksheets

Many interactive worksheets are implemented as mobile or laptop applications. Others take the form of web-based applications (such as the example shown above). In this document, we focus on the creation of interactive worksheets as HTML pages accessed and managed via World Wide Web browsers.

1.4 Dynamic Logic Programming

The bad news here is that the process of implementing Web-based worksheets using traditional programming technologies can be time-consuming and expensive. The common practice is to use client-side technologies (e.g. Javascript) together with server-side technologies (such as MYSQL and PHP or Java). Creating worksheets in this way requires a high level of technological sophistication and significant programming effort.

The good news is that it is possible to simplify this process without significant loss of functionality. Making it easier for developers to create and maintain worksheets. And in many cases making it possible for non-developers to do the same. Creating and maintaining worksheets can and should be "do it yourself" (DIY). Just as it is possible for users without programming expertise to create and manage traditional spreadsheets, it should be possible for users without traditional programming expertise to create and manage worksheets on their own.

The key is an approach to specifying behavior known as Dynamic Logic Programming (DLP). DLP combines (1) the simplicity of databases for representing data with (2) the flexibility of traditional logic programming for defining concepts and specifying constraints and (3) the power of operation definitions for prescribing behavior.

Admittedly, using DLP to define behavior still requires some work, just as writing the formulas in a traditional spreadsheet requires some work. However, experience has shown that the effort required is far less than that required to build interactive worksheets with traditional programming technologies. Moreover, it is easier for people to learn DLP than to learn traditional programming.

1.5 Reading Guide

This document is an introduction to the use of Dynamic Logic Programming in creating HTML Worksheets. In Chapter 2, we show how to how to create simple reactive worksheets, i.e. worksheets in which behavior is defined directly in terms of visible features and user gestures. In Chapter 3, we talk about the use of DLP in semantic modeling, i.e. encoding the relationship between these syntactic elements and application-specific concepts. In Chapter 4, we introduce datasets and show how they can be used to organize data, support persistent storage, and enable collaboration among homogeneous and heterogeneous worksheets. In Chapter 5, we talk about channels and show how they can be used in describing multi-step behaviors, creating logs, and facilitating private communication among worksheets.

The presentation here assumes the reader is already familiar with HTML and the Document Object Model (DOM) that most web browsers use as an internal representation for web pages. It also assumes the reader is familiar with the rudiments of Dynamic Logic Programming (view definitions and transition rules). For more information on HTML, click here. For more information on the Document Object Model, click here. For more information on Dynamic Logic Programming, click here.