| Literate Programming |
Website Links For Literate Programming |
Information AboutLiterate Programming |
| CATEGORIES ABOUT LITERATE PROGRAMMING | |
| software engineering | |
| technical communication | |
| programming paradigms | |
|
Documentation and Source Code are written into one Source File . Both the complete source code and its documentation can be extracted from this file with specific utilities. The information is written and presented in a reading order suitable for human consumption with detailed explanations. The code is automatically rearranged for ordinary processing by other computer tools, such as compilers or interpreters. HISTORY AND CURRENT IMPLEMENTATIONS The first published literate programming environment was WEB , introduced by Donald Knuth in 1981 for his TeX typesetting system; it uses Pascal as its underlying programming language and The complete commented RELATED CONCEPTS Outlining Outlining editors are sometimes seen as providing a variant of the original concept of literate programming as used by Knuth. In particular, Leo combines outlining with interfaces to noweb and CWEB processors. Embedded documentation There are also less powerful systems to integrate documentation and code than literate programming; examples are Pod for Perl , Doc++ for C, C++ and Java, Javadoc for Java , and Doxygen for many languages. These however do not quite follow the literate programming philosophy since they typically just produce documentation ''about the program'', such as specifications of functions and parameters, and not documentation ''of the program source code'' itself. They also do not allow rearrangement of presentation order, which is critical to the effectiveness of literate programming. See Documentation Generator . Haskell is a modern language that makes use of a limited form of literate programming: this ''semi-literate'' style does not allow code re-ordering or multiple expansion of definitions but lets the programmer intersperse documentation and code freely. It is the fact that documentation can be written freely whereas code must be marked in a special way (see the example below) that makes the difference between semi-literate programming and excessive documenting, where the documentation is embedded into the code as comments. EXAMPLE OF A SIMPLE LITERATE PROGRAM This whole article is, in fact, a simple program that can be run using the example literate interpreter on the Interpreter page. For this particular interpreter, all the program code must be written on lines starting with a dash. Everything else, i.e., the bulk of this article, is ignored by the interpreter. This does not support some important aspects of advanced literate programming like code rearrangements or multiple expansion and so should only be called basic literate programming or "semi-literate" literate programming. Program and interspersed documentation Firstly, in the interests of putting the user at ease, the program will simulate personal interest in the user by asking for their name, accepting the input and generating a greeting based on the input text.
Continuing the "query-response" mode of operation, prompt the user for the radius of a circle, which is then used to calculate the area of a circle using the standard formula for the area of a circle: . Due to syntax limitations, this is done by multiplying the input value by itself, then by ;. This calculated value is returned to the user. Note: the value of ; used is an approximation that is sufficiently accurate for our purposes.
Finally the user is asked for the required information, and the area of the rectangle is worked out using the standard width by height formula.
And that is the finished program. REFERENCES
EXTERNAL LINKS
|
|
|