Elucidative Programming

Kurt Nørmark ©
Department of Computer Science, Aalborg University, Denmark


Index References Contents
These slides is a presentation of Elucidative Programming given in Görlitz, Germany. The presentation was given December 14, 2005.


Where is Denmark?
Slide Note Contents Index

Figure. The location of Denmark in Europe

Where is Aalborg?
Slide Note Contents Index

Figure. The location of Aalborg in Denmark

Plan of this talk
Slide Note Contents Index

  • Program Understanding and Program Documentation

  • Literate Programming

    • Concepts and idea

    • Problems

  • Elucidative Programming

    • What is it?

    • The model behind it

    • Tools

    • Documenting program evolution

  • Status and Conclusion

Slide Note Contents Index
We start this talk with a view on two basic program comprehension approaches. We here distinguish between whether program comprehension has been written on before hand, or whether the understanding is going to be extracted from the source program.

Program comprehension plays a major role in any non-trivial software development effort

"To program is to understand"

  • Two basic program comprehension approaches

    • Prevenient/proactive

      • The program understanding is formulated as a forethought before or during the development of the source program

    • Posterior/reactive

      • The program understanding is formulated as an afterthough following the completion of the source program.

Here we want to make a distinction which represents when the program comprehension is dealt with relative to the time where it is actually needed.

The prevenient approach represent the cases in which some documentation is explicitly written before it is needed.

The posterior approach, on the other hand, represent the cases in which the comprehension is attempted to be extracted from the program, when it is needed typically in a late phases of the program life time.

Kinds of understanding
Slide Note Contents Index
There are many different ways to classify program understanding and program documentation. Here we present a classification of program understanding which focuses on the documentation needs before, during, and after the central development efforts.

System and program understanding can be classified in many different ways

We hypothesize that several kinds understanding can benefit from the ideas of elucidative programming

  • A classification of program-related descriptions and discussion

    • Proactive mental understanding

      • Design and architectural issues

      • Oriented towards the author or co-developers

    • Process understanding

      • Descriptions that keep the practical and everyday activities on track

      • Diaries and logs

    • Maintenance understanding

      • Conveying relevant information from the developers to maintainers

      • Best to write after the development is finished

Which kind of documentation
Slide Note Contents Index
We start with a few - but important overall observations concerning our approach and our work.

There are many kinds of documentation: analysis documentation, design documentation, interface documentation, internal program documentation, user-oriented documentation, ...

  • In this work we focus primarily on internal program documentation.

  • Integrated documentation

    • Addresses the connection between program and documentation

    • Several possibilities will be explored

Our tools are probably useful in any situation, where there is a need to write about a program

Views on documentation
Slide Note Contents Index
There are many different views on documentation, including common attitutes that are reconfired among programmers to such a degree, that most of us belive they are true.

Many programmers are reluctant to read and write program documentation

  • Documentation of program understanding

    • Programming requires understanding of both the problem and its solution

    • We cannot afford to forget the understanding once established

    • It is expensive to reestablish the understanding if its forgotten.

We see documentation as an investment

We hypothesize that the investment is payed back during the life time of the program

We call for a professional attitude

Integrated program documentation
Slide Note Contents Index
We will here explore the possibilities of integrating programs and written program documentation

There are several ways to integrate the source program and the documentation

  • The documentation is embedded in the program

    • Conventional program comments

    • The program is the main structure

  • The program is embedded in the documentation

    • Literate Programming

    • The documentation is the main structure

  • The program and the documentation are separated, but connected via links

    • Hypertext approach

    • The starting point of Elucidative Programming

Literate Programming

Literate Programming and the WEB System
Slide Note Contents Index
Here we will briefly describe an important background and inspiration, namely Knuth's ideas of literate programming.

Knuth invented literate programming in order to explain and publish his programs in articles and books

  • Characteristics of literate programming:

    • Detachment of program explanation structure from program structure

    • The proximity between program fragments and their explanations

      • The pieces of program 'live in' the documentation

      • The opposite approach of conventional program commenting

Literate programming is typically supported by tools in the WEB-family

An example of a literate program
Slide Note Contents Index
For those who do not have a background in literate programming we here show an example of a simple literate program. The program is in Danish, but it should nevertheless be possible to get a general understanding of the approach.

In order to be concrete we briefly present an example of a literate program and the source from which it is generated


Internal structure of a literate program (1)
Slide Note Contents Index

Internally, a literate program is made by a hierarchical program and a linear document structure

Figure. The internal literate programming structure.

Internal structure of a literate program (2)
Slide Note Contents Index

The tangle tool extracts and assembles the source program

Figure. The program as assembled from the WEB above.

The WEB tools for literate programming
Slide Note Contents Index
There are two classical WEB tools for literate programming. We here show the roles of these two tools.

There are two central WEB tools: weave and tangle

Figure. The 'classical illustration' of the processing done by the WEB tools tangle and weave.

Problems with WEB-like literate programming
Slide Note Contents Index
Elucidative programming is meant to be an alternative to WEB-like literate programming. Therefore it is natural to identify a number of problems with classical literate programming which we attempt to remedy in our variation of literate programming.

  • The Program is embedded in the documentation
    Only few programmers want to split their programs in fragments and to organize these as parts of the documentation

  • Language mixing
    The mix of three languages in a single document is not attractive

    • Documentation language, programming language, WEB interconnection language

    • Reading and comprehension problems in the WEB-source files

  • Extra level in error handling
    Error handling is more complicated because the errors need to be mirrored in the WEB source program

  • Paper orientation
    Most existing tools are oriented towards printed paper presentation of the literate program

Despite these problems the original ideas and tools remain to be very interesting and attractive for skilled and motivated users

Elucidative Programming

The meaning of the word
Slide Note Contents Index
The verb 'elucidate' may not be part of the working vocabulary of many Danes. Therefore we introduce the meaning of the word on this slide

"To elucidate is to make clear or plain, especially by explanation"

"To throw light on something complex"

Elucidative Programming
Slide Note Contents Index
At this place we introduce elucidative programming. We here describe a number of key properties of the documentation approach.

Elucidative programming is meant to be a variant of literate programming

Elucidative programming remedies some of the identified problems with literate programming

  • Elucidative programming highlights:

    • Leave the program "in peace"

      • Does not impose any requirement on the organization of the program in files or directories

    • Address existing abstractions from the documentation

      • Does not rely on separately named program fragments

    • User interface

      • Present the program and the documentation side-by-side in an Internet browser

    • Supported by the development environment

      • Requires specialized editor functionality

We will return to all of these items later in the presentation

Slide Note Contents Index
The first paper we wrote about elucidative programming was focussed on a number of requirements. These requirements are listed on this page.

  • Target
    The internal documentation must be oriented towards current and future developers of the program

  • Purpose
    The internal documentation is intended to address explanation which serves to maintain the program understanding and to clarify the thoughts behind the program

  • Separation
    The program source file must be intact, without embedded or surrounding documentation

  • Tools
    The programmer must experience support of the program explanation task in the program editing tool

  • Chunking
    The program 'chunking structure' follows the main abstractions supported by the programming language

  • Medium
    The documented program must be available in an attractive, on-line representation suitable for exposition in an Internet browser

An example of an elucidative program
Slide Note Contents Index
In order to be concrete we will here give an example of a literate program. The program is referred in the NWPER'2000 paper, which is being presented during these slides.

The first example is an artificial elucidative demo program

The second example illustrates the development of a small program that converts a large integer, representing the number of seconds elapsed since January 1, 1970 to a conventional date and time structure


More examples of elucidative programs
Slide Note Contents Index

The examples illustrate a demo program in Scheme, a real life LAML tutorial based on Scheme, and two educational Java programs

The elucidative programming model
Slide Note Contents Index
This page describes a number of important concepts behind the elucidative programming model.

  • Entities

    • Named abstractions on the program side

    • Sections and subsections on the documentation side

    • A naming scheme that allows us to address the program entities from the documentation

  • Relations

    • A doc-prog relation which connects explanations with program entities.

    • A prog-prog relation which connects applied and defined name occurrences

    • A doc-doc relation which connects explanations across the hierarchical documentation structure

  • Source markers

    • Represent positions in a program which we want to address in the explanations

  • Documentation bundle

    • An aggregation of programs, documentation text, and processing parameters.

The source format of the documentation - Scheme
Slide Note Contents Index
When the programmer works with a literate program the source format of the documentation is of particular interest. This format is important because it constitute the words and lines actually written by the programmer. In addition, the programmer will spend much time reading parts of the documentation in this format. Therefore the properties of the format matters. This page is related to the Scheme elucidator only.

An specialized markup language is used for the overall structure, the documentation texgt, the relations, and the source markers

HTML is used for additional markup purposes

  • Two different markup languages are supported:

    • A terse, ad hoc markup language.

      • Brief and easy to read

      • Makes use of native HTML

    • An XML-in-LAML markup language

      • More voluminous

      • Homogeneous

      • Makes use of HTML-in-LAML


Tool Overview
Slide Note Contents Index
There are three important tools in an elucidative programming environment. Of these, a standard Internet browser counts for one. The others are the editor used for programming and documentation, and the tool which produces the underlying browser format.

  • The elucidative programming environment for Scheme contains the following tools:

    • An elucidator which processes the program sources and the documentation source

    • An editor which is used for both programming and documentation authoring

    • An internet browser which is used for presentation of the elucidative program

The elucidator plays the role of the literate programming weave tool

In elucidative programming there is no need for a tangle tool

The elucidator tool
Slide Note Contents Index
The elucidator tool produces the HTML pages to be shown in a browser. In addition, the elucidator tool makes a number of data structures used by the editor to gain knowledge about the documentation bundle.

The elucidator is the tool that processes a documentation bundle in order to produce an elucidative program

  • Tasks of an elucidator:

    • Abstraction

      • Parses the documentation and the program

      • Extracts knowledge about program and documentation entities

    • Synthesis

      • Generates the HTML pages with links that represent the three kinds of relations between entities

The Scheme Elucidator do both abstraction and synthesis statically

Alternatively, the synthesis may be done dynamically by the web server.

The editor tool
Slide Note Contents Index
The editor tool for the elucidator plays a major practical role. It is important that the programmer can continue working in his favorite environment. We will assume that our programmers use Emacs. Therefore we chose be augment the Emacs text editor with elucidator support.

It is of major importance to provide for easy and flexible editor support of elucidative programming

We have augmented Emacs with elucidative facilities

  • Design objectives:

    • The editor applies a split-screen layout in the same way as the browser

    • The editor's support of the programming language is available in non-changed form

    • The creation of the doc-prog and doc-doc relations is nursed in particular

    • The major navigation possibilities - as supported by the browser - are also present in the editor

    • The editor keeps the documentation bundle together by a special marking of the involved buffers

The browser tool
Slide Note Contents Index
The browser tool of an elucidative programming environment is just a standard, modern Internet browser. On this page we emphasize the typical frame layout used by an 'elucidative browser'.

The browser tool is realized by an ordinary Internet browser

  • Characteristics of the browser

    • The "T layout" of the browser window, supporting a side-by-side alignment of documentation and program

Figure. The basic frame layout of an Internet browser that presents an elucidative program


Tool Integration
Slide Note Contents Index
Tool integration is a key issue when two or more program development tools are used together. On this page we discuss integration issues of the tools in an elucidative programming environment.

The current integration of the editor and the elucidator is simple and rather primitive

  • Cooperation between the elucidator and the editor

    • The elucidator abstracts information from the documentation bundle which the editor can read on demand

    • The editor is always a step behind with respect to knowledge about the current documentation bundle

    • The elucidator can be activated very smoothly from the editor

Mutual activation of the browser from the editor - and vise versa - would be a major practical improvement

Tool philosophy
Slide Note Contents Index
Here we will discuss possible and different tool organizations. We call it 'tool philosophy'. Our point is not to force the programmer into a specialized environment for authoring of program documentation. We go for documentation enabling of existing environments. In our experience, programmers are rather conservative, and most of them want to continue working in their favorite environments. There must be major advantages in a new environment in order for the programmers to shift.

  • Possible tool organizations:

    • Provide a brand new tool with an embedded editing environment for elucidative programming

      • The Dogma System

    • Introduce a separate tool and augment an existing editor with knowledge about elucidative programming

      • Typically a Unix and Emacs solution

    • Include elucidative aspects into current integrated programming environments

      • Long term goal?

      • Actually tried out with the Java Elucidator and TogetherJ

      • Why not make an Eclipse plugin?

Many programmers do not want to be forced into a new and specialized editing environment

Integration with LAML SchemeDoc
Slide Note Contents Index

LAML SchemeDoc is a traditional library interface extraction tool for Scheme

  • Integration between the Scheme Elucidator and SchemeDoc

    • From SchemeDoc it is possible to navigate to a richly linked version of the underlying Scheme source program

    • From the Scheme Elucidator it is possible to arrange for linking to SchemeDoc pages instead of linking to Scheme source pages


A broader perspective on the use of an elucidator
Slide Note Contents Index
Here we will list a number of potential areas which we expect can be supported by the elucidator.

Most documents that need to address program units or program details will be able to benefit from the ideas of elucidative programming

  • Documents with 'an elucidative potential':

    • Diaries and logs

    • Written code reviews and code walk throughs

    • Program tutorials

    • Design documents

    • Maintenance documentation

Program Evolution
Slide Note Contents Index

How do we make best use of an up-to-date program and outdated documentation?

How do we document the evolution of the program?

  • It is possible to process several versions of a source program together with one version of the documentation

  • Automatic bookkeeping of fine grained program evolution steps

    • New, deleted, moved, renamed abstractions

    • Extensive crosslinking of program versions

  • Possible to address both new and old versions of abstractions from the documentation

    • Provides for documentation of the program evolution


Adds much more value to a program with (partially) outdated documentation


Industrial experience
Slide Note Contents Index

The Java Elucidator has been used by three programmers in Danish Java software house.

This experiment was carried out by Max R. Andersen and Claus N. Christensen

  • Feedback:

    • Elucidative Programming is applicable in industry

    • The tools were addapted - but they probably need improvements

      • Problem with two representations (development, browser).

      • Abstraction requires that the program can be compiled

    • A group communication potential was revealed

      • Not easy to capture and represent verbal communication

Industrial quotes
Slide Note Contents Index

  • "Elucidative programming is a paradigm which fits the lightweight process we use"

  • "I believe that if we did not have such an Elucidator tool, then in the best case this would be scribbled down on a piece of paper, which would eventually be scrumpled up"

  • "If I was to write the documentation completely isolated from the source code - well then it would have been completely useless - so it has to be done on the source code in some way"

  • "At first it feels like: this takes time. But I do not think this is necessarily the case"

  • "This is not end user documentation, and it is not polished analysis and design. It is actually very intimate, so on that set it reminds me a lot of this diary I have written from time to time"

  • "It is probably something you has to integrate in the process... to get it on your mind, as a daily activitiy, as a natural part, right?"

  • "I do not dare to mess with this, but I can always make a note about it - if I one day want to change something"

Status and Conclusions

Status and Conclusions
Slide Note Contents Index
We conclude this presentation with some brief accounts on the status of our work.

  • Contributions:

    • A renewal of the tool ideas for literate programming

    • A serious attempt to present programs and their internal understanding on the Internet

  • Status

    • A complete and operational prototype of an elucidative Scheme environment exists

    • An experimental and operational prototype of an elucidative Java environment environment exists


Further Information

Web resources about Elucidative Programming
Slide Note Contents Index

These slides are available from the elucidative programming home page

Both the Scheme Elucidator and the Java Elucidator are free and open software

Collected references
Contents Index
An example of the literate program source program (section 5) - in Danish
A literate Life Program in Pascal - NuWeb - in Danish
The Time Conversion example
Elucidator Demo
The Demo XML-in-LAML source
The documentation text of the time example
The setup of the time example
The Time Conversion example
Elucidator Demo
A SchemeDoc page of the XML-in-LAML library
A real life versioned elucidative program
A demo of a versioned elucidative program


Elucidative Programming
Course home     Author home     About producing this web     Previous lecture (top)     Next lecture (top)     Previous lecture (bund)     Next lecture (bund)     
Generated: December 19, 2005, 14:17:13