Literate programming

With literate programming (English, approximated with literary programming translatable ) is called the writing of computer programs in a form so that they are readable, especially for men.

Literate programming is technically seen that both the documentation and the source code of the program are available in a common file. Special tools ensure that both the source code and documentation can be extracted from this file. As written documentation for humans is in the foreground, the order of the program expression is designed so that they can be of course recorded.

Motivation

In Communications of the ACM asks 1986 Jon Bentley: " When was the last time you spent a pleasant evening in a comfortable chair, reading a good program? " ( German: " When was the last time that they comfortable an enjoyable evening in a have spent armchair and have it read a good program? ") the background of this question is based on the fact that, while so many programmers does an excellent job and, accordingly, created good programs, but that hardly a programmer its programs sufficiently documented.

History

The addressed problem has been recognized earlier: The first programming environment that literate programming supported, was the WEB developed by Donald Knuth. 1981 developed for the implementation of the TeX system, it used Pascal as a programming language and as TeX documentation generator. Successor of WEB was CWEB, which used C as a basis.

Characteristics of Literate Programming system -

A Literate - Programming system allows:

Related policies and programs

The original concept was eventually adopted by other developers and also found in other programming languages ​​partially reflected.

Documentation generators

The Doxygen documentation generator ( similar to Java with Javadoc ) uses the concept of partial order: specially formatted comments in the source code ( in one of the supported programming languages) can be extracted and included in a documentary. In contrast to the original thought, only a detailed specification of the source text and its structure is made possible by this concept (function parameters can be specified exactly ). A complete documentation of the source code, however, is not possible with these programs, precisely because a reordering of the program is not possible.

Special programming

The Haskell programming language allows literate programming already on the source code level: Comments and program instructions may be freely mixed. Unlike other programming languages ​​is especially marked in the source code of this strategy - and not the associated comments. However, a rearrangement is not possible here.

General typesetting systems

By suitable interleaving of source code and comment can be reached with the use of appropriate typesetting systems Literate Programming. So you can for example write C source code so that it can be compiled with the C compiler to a program, but with troff / groff from a PostScript document can be created with graphics. Here are to be accepted compared to "real" Literate - programming tools some limitations in functionality, since a special software can offer more options than general text typesetting systems ..

Programming by Intention

Programming by intention (not to be confused with intentional programming) is a concept of agile software development, which states that in the implementation of methods not as usual algorithms are implemented, but "only" intentions are written down. These intentions then usually meet other auxiliary methods or single-line algorithms. This ensures that the program is without any programming knowledge extremely easy to read.

Software

  • WEB (the original)
  • Noweb
  • CWEB by Marc van Leeuwen
  • Funnelweb ( not based on WEB / CWEB )
  • Fweb ( development of CWEB )
  • LEO, " Literate Editor with Outlines "
524834
de