Literate Programming meets UML

Alun Moon
School of Informatics, University of Northumbria, UK

Thursday July 20, 2003


This work is an ongoing small project to apply the benefits of Literate Programming to UML. Literate programming is a powerful tool in that it places the emphasis on the documentation of the algorithm, and allows the code to be developed in a logical order. UML is a useful graphical notation to describe features of a software system. However it lacks the ability to document the code and algorithm in detail. This gap can be filled by Literate Programming. Elements of UML can usefully enhance the documentation part of a web, with ``a picture worth a thousand words''. Finally the process of tangling a web into a program is applied to the UML to create a final diagram from fragments throughout the web. The diagrams are `enhanced' by having TEX available to typeset the text in the diagrams.

Producing diagrams is in the domain of Metafont and Metapost. Metafont provides enough features to layout a UML diagram. Metapost is used in this work as it uses the features found in Metafont and allows text to be typeset in the diagram.

The project has needed to define a set of web metatools. A single web file usually corresponds to a single source code file, which corresponds to a class in the diagram. As the diagram contains several classes, it needs to combine elements from several webs. Each web file contributes a class to a class diagram, just as each web contributes a C file to a project which are then compiled and linked together.

As well as developing a set of Metapost primitives for UML, this project has also proposed extending the tags for cweb to allow elements of the diagram to be constructed. These tags also interact with the metatool to allow extraction of the diagram elements. As this tool may be introduced to undergraduates, a port to work with Java (jweb) is underway (Java is the teaching language in this School).

A discussion is made of how to identify public and private equivalents of methods when using ANSI C. This being a preferred language (over C++) for embedded systems. Cweb is being introduced to colleagues in the school and suggested for use on a Masters in embedded systems. Literate Programming has also been suggested as a way to help students think about the design (engineering) of program code, by concentrating on the documentation rather than the coding. It may play a role in both teaching and research.

[ abstract 35.2 KB ]
[ slides* 160 KB ]
[ preprint ]

* Note: The slides should be downloaded and viewed with Acrobat Reader.
Some slides are in landscape orientation and others in portrait.
Browser plug-ins may rotate the portrait slides 180 degrees

Back to the Bulletin News

| 1-Sunday | 2-Monday | 3-Tuesday | 4-Wednesday | 5-Thursday | 6-Friday |

Wendy McKay 2003-12-20