Category: 

What is Literate Programming?

Article Details
  • Written By: Malcolm Tatum
  • Edited By: Bronwyn Harris
  • Last Modified Date: 22 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
In late 19th-century London, mail was delivered to residential addresses up to twelve times each day.   more...

September 28 ,  1924 :  Two US military planes complete the first flights around the world.  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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

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

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

everetra
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

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}