What is Literate Programming?

Literate programming is a strategy that serves as an alternative to structured programming. The underlying idea behind this type of programming is to allow developers to focus more on logic and the flow of their thought processes when writing programs, rather than requiring that the programming be written in a way that is mandated by the computer where the software is intended for use. With this approach the programmer focuses more on the most logical way to write the programming so it achieves the desired result, then focuses on how to program the computer so that the software works properly.

Unlike structured programming, literate programming often makes use of common-day language combined with source code that is considered traditional. This approach makes it possible for the programmer to create macros that are descriptive and explanatory in nature, based on the though processes of the programmer. The end result is the creation of a language that effectively covers the underlying programming language with these explanatory phrases. With literate programming, the code documentation is considered equal to the code itself, rather than being subsidiary or auxiliary in nature.

Another aspect that helps to distinguish literate programming from structured programming is the way the elements of the programs interact with one another. In structured programming situations, the interaction is more vertical or hierarchical in design. With the literate approach to the programming task, the elements are thought in terms of an interwoven mosaic, in which the elements are more or less equal with one another.

Proponents of literate programming typically make the claim that this particular approach makes it necessary for programmers to articulate the thought processes that go into the program. This offers the advantage of being able to identify flaws in the logic of the programmer with more precision, and implement changes or modifications that allow the programming to operate with more precision and efficiency. In addition, the very nature of this approach helps to create a trail of documentation that makes it easier to reconstruct the logic applied to the task from beginning to end. In terms of adapting the code for specific applications by end users, this makes it easier to follow the stream of logic for the base program, and identify a point to branch off of in order to execute a specific task. From that point, the programmer can add or modify the code so that essential functions are not impaired, and the new function is easily integrated into the overall process.