Internet
Fact-checked

At WiseGEEK, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What is Literate Programming?

Malcolm Tatum
Malcolm Tatum
Malcolm Tatum
Malcolm Tatum

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.

Literate programming uses modern, common language to create scripts.
Literate programming uses modern, common language to create scripts.

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.

Malcolm Tatum
Malcolm Tatum

After many years in the teleconferencing industry, Michael decided to embrace his passion for trivia, research, and writing by becoming a full-time freelance writer. Since then, he has contributed articles to a variety of print and online publications, including WiseGEEK, and his work has also appeared in poetry collections, devotional anthologies, and several newspapers. Malcolm’s other interests include collecting vinyl records, minor league baseball, and cycling.

Learn more...
Malcolm Tatum
Malcolm Tatum

After many years in the teleconferencing industry, Michael decided to embrace his passion for trivia, research, and writing by becoming a full-time freelance writer. Since then, he has contributed articles to a variety of print and online publications, including WiseGEEK, and his work has also appeared in poetry collections, devotional anthologies, and several newspapers. Malcolm’s other interests include collecting vinyl records, minor league baseball, and cycling.

Learn more...

Discussion Comments

NathanG

@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.

Mammmood

@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.

everetra

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
Login:
Forgot password?
Register:
    • Literate programming uses modern, common language to create scripts.
      By: Anna
      Literate programming uses modern, common language to create scripts.