What is Literate Programming?

Article Details
  • Written By: Malcolm Tatum
  • Edited By: Bronwyn Harris
  • Last Modified Date: 18 May 2017
  • Copyright Protected:
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
In Antarctica, moss is growing 4 or 5 times faster than it did before 1950, turning some of the continent green.  more...

May 27 ,  1907 :  Bubonic plague broke out in San Francisco.  more...

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.


You might also Like


Discuss this Article

Post 3

@Mammmood - I agree. It’s clear that source code is still included in the literate programming model, so what’s the point of literate programming?

You’re trying to abstract away the computer logic, all the while including the macros in your files. It doesn’t accomplish much in my opinion.

I believe that if you want to learn how to program without getting bogged down in one computer language’s syntax, then you should try instead to learn pseudo code.

Pseudo code is a natural language representation of the coding logic that you want to express. Since pseudo code is not tied to a particular language, you can learn it, then apply it across any programming language that you desire.

Post 2

@everetra - I am a hardcore programmer myself and am familiar with tools programming environments include to make development tasks easier.

What you’ve described seems to be one such tool, but I don’t know that it’s exactly the same as literate programming. I think literate programming is a way of creating natural language expressions that convey what you want the computer to do inside of learning computer code syntax.

That’s neat in theory, I think, but at some point those natural language expressions need to be tied to a programming function or code somewhere. Somehow your programming compiler needs to understand what your terminology means.

At that point, in my opinion, it’s really not much different than standard coding; you’re going to have to get your feet wet with coding at some point.

Post 1

I’ve never done any literate programming as such, but I have used tools that I think emulate the process.

In SQL Server you can use something called “packages” which are basically flowcharts that provide a high level view of a process you want performed.

The symbols in the flowcharts are not just pictures however. They are scripts. Think of them as macros. So what you do is build your flowchart to describe your “program” as it were, and then you can write scripts or use a wizard to generate scripts for you.

Then you “run” the flowchart and it steps through each phase of the process, running scripts along the way. I don’t know if this is exactly what literate programming is like, but it seems similar, because you are focusing more on the high level logical processes than you are the programming language as such.

Post your comments

Post Anonymously


forgot password?