Literate Programming in XML
15:13, 18 Dec 2002 UTC | Eric van der Vlist

Norm Walsh presented at XML 2002 his implementation (XWEB) of Literate Programming in XML, available as part of his DocBook stylesheets, which enables the extraction of both documentation and code from common documents.

Introduced in 1984 by the father of TeX, Donald Knuth, Literate Programming is a software development methodology that focuses on documentation by embedding the source code in the documentation. Michael Sperberg-McQueen has proposed its application to SGML back in 1993.

Its principle is to document code fragments (classes, methods, variables or XSLT templates are examples of code fragments), to include the code fragments in their documentation and to link them into a "web." This web can then be transformed to produce readable documentation in any format on one hand, and the source code on the other hand.

Norm Walsh at XML 2002The XML implementation presented by Walsh is thus based on mature concepts and its current version has been published in March 2002. It supports not only embedding traditional languages such as Perl or Java but also XML languages such as XSLT, schemas or any other XML "code". Support for languages such as Python would probably require some adaptation since XWEB doesn't appear to care much about indentation.

Literate Programming isn't incompatible with other methodologies such as Extreme Programming, and among the extensions which seem most interesting, one could probably easily add the definition of the unit tests within the documentation of the code fragments.

Purists will also note that, following the tradition, XWEB is implemented through XWEB documents, a minimal XSLT transformation being provided to "bootstrap" these documents into usable pieces of code which consist mostly of XSLT transformations.

Other stories:

xmlhack: developer news from the XML community

Front page | Search | Find XML jobs

Related categories