📜 ⬆️ ⬇️

Literary programming

Less than a month I learned about literary programming, but
the concept itself made an indelible impression on me, made
rethink some things and reduce steam for a couple with maximalism
in some judgments. On the technical side of the literary
programming (i call it literary, not literate; i
It seems to be closer in meaning to the original title) I saw a couple
wonderful articles in runet, but I want to talk about emotional
to his side, hopefully it will give you the motivation to dig
deeper. Emotional words would have sounded from my lips.
a few ... in fanboy, so leave them for later, and now
I'll suggest you read a few quotes from the creator of the methodology, Donald

I did the translation with Google Translate, and this is my
The first published translation - I will ask you to kick only the case.

Fragments from the article "Literate Programming", 1983:
I believe the time has come for much better documentation.
programs, and that we can achieve this by making programs
literary works.

Let's change our traditional attitude to building programs:
instead of the notion that our main task is to explain
computer what to do, let's focus on explaining to the person
what we want the computer to do.

Literary programming practitioners can be thought of as
an essayist whose main concern is exposure and perfection
style. Such an author, with a dictionary in hand, carefully chooses the names
variables and explains why we need each of them.

In the above quote should ponder more seriously and not skip
as something obvious. The word exposition is packed a lot of sense, and
his understanding is essential for uncovering the idea of ​​literary
programming. I give the definition of Wikipedia.

Exposure in literature - part of the work preceding
the beginning of the deployment of units of the structure of the product, in particular, part
works that precede the beginning of the plot. The exposure should
placement of actors, the circumstances, are shown
reasons that "trigger" plot conflict. Exposure can
follow both before and after the tie.

Exposure in the LP is one of the main ideas; the point is that
the author should explain to the reader the literary program where it came from
any piece of code and why it is there where it is.

He or she seeks a program that is understandable because her ideas
were presented in order that is best for human
understanding using a mixture of formal and informal methods
mutually reinforcing each other.

We understand the complex system by understanding how its simple parts are arranged, and
understanding the simple relationships between these parts and their immediate
neighbors. If we express a program as a network of ideas, we can
emphasize its structural properties natural and satisfactory
in a way.

This is a word about why many of the tools for LP have in their
The name of the word is web [web].

I dare to suggest that such achievements in the documentation are possible because
the experience that I received during the last few years during
intensive software development (here Knut talks about
the development of TeX and METAFONT). Taking advantage of a few ideas that
have existed for a long time, and systematically applied them slightly
in a new way, I came across a method of creating programs that is extremely
I was excited.

In fact, my enthusiasm is so great that I must warn
reader to perceive a lot of what I say, like a raving fanatic,
who thinks he just found
enlightenment. Programming is a very personal activity.
therefore I cannot be sure that what worked with me will be
work with everyone. However, this new approach has fundamentally influenced
my own style, and my excitement does not subside to this day - more than
two years. I like this new methodology so much that it is difficult
keep from not going back to every one ever written
I program and not to alter it in the "literary."

I cannot resist the urge to work on tasks for
programming, which I usually instruct student assistants
research; and why? Because it seems to me that I can finally
write programs as they should be written. My programs are not
only explained better than ever before; they are better than programs,
because the new methodology makes me do my job better.

A short excerpt from an interview with Donald Knut, 20 years later:

- One of your few projects that did not cover a wide
a community of programmers, this is literary programming. What are
your thoughts on why literary programming didn't stick? AND
is there anything that you would do differently in retrospect
regarding literary programming?

- Literary programming is a very personal thing. I think it is
awesome but maybe this is because i'm very strange
person. He has tens of thousands of fans, but not millions.

Judging by my experience, programs created using literary
programming turned out to be significantly better than the program
developed in a more traditional way. But the usual programs still
were good enough so the traditional methods stay with us -
they are understood by a vast community of programmers, and most people
there is no particular need to change something; just as I am not motivated to teach
Esperanto, even knowing that he may be preferable to English,
German or Russian.

John Bentley probably dotted i when asked “why
literary programming didn't conquer the world? "He said that only
a small percentage of all people are good at programming, and a small
the percentage is good at writing; and you ask me to all people
were in two of these categories at once.

As for me, literary programming is the most important thing
which came out of the TeX project. It not only allowed me faster and
safer than ever to write and maintain programs, it was
one of the biggest sources of joy since the 1980s, and at times without
it was impossible to do. Some of my main programs
such as the MMIX meta-simulator, could not be written using
any other methodology I've ever heard of. They were
just too complicated for my limited brain; without
literary programming like enterprise just failed

If people discover good ways to use the newfangled
multithreaded machines, I expect the discovery will come from people who
daily use of literary programming. Literary
programming is what you need to rise above the next
level of achievement. But I do not believe in the violent acceptance of ideas. If a
literary programming is not your style, please forget about it and
do what you like. If it is not like anyone except me -
let him die.

From the positive: I was pleasantly surprised to discover that the rules of CWEB
( literary programming systems for C ) are already
standard in preinstalled programs such as the Makefile in
modern Linux.

As for me - I think that literary programming is very, very
badly lacking in open-source projects and especially in training
programming (it is not used formally with the corresponding

Last year I watched the life of the community very closely.
lisperov-klozouristov and absorbed all available information on the network
this topic: the planet of blogs, twitter, 3 books published today. After
I had a rather dense "immersion" in this topic.
vague suspicion about the approach to learning Clojure and
related infrastructure. Then I learned about LP and vague
the suspicion cleared up. Judge for yourself. Now in the world there are three books about
Clojure and their contents intersect very strongly,
approximately it can be described as 100500 weakly connected with each other
recipes for placing rakes provided by this language
specific version. Reading all three books will not make you
professional You can read a thousand books like this - by master
you will not become. All 3 books run into an impenetrable wall; you know
that there is a treasure behind the wall, simple and concrete; but you can't
get to him through the thorns of scattered and obscure
outlines. Similar technical literature is the essence of the clip
thinking: as if I was fed well brewed porridge from
nutritious and damn healthy pieces but I can never by her
to be full, because they feed me with the secondary, leaving the essence

Clojure, like all lisps, is inherently extremely simple.
constructions. Someone said “source is the best documentation”; for
The family of these languages ​​is the absolute truth. In fact, that part of the language
which is directly used by the user, is described on the
Clojure in one core.clj file about 5 thousand lines in size. it
transparent as a tear of the baby code with comments from which
generated quite simple but high-quality documentation. Reading
This file for a cup of tea will be the beginning of that journey for
wall clips to the very essence of the technology used. But further
promotion is much more difficult - the next ones on the way will be
Java sources that describe the compiler, transactional memory,
references, agents, and persistent data structures. And not one
comment - there the devil himself will break his leg. And the thing is not at all
difficult, but those who are really thorough, or at least approximately
knows the structure of this whole technology up to its very foundation - by orders of magnitude
less than those who studied it to this difficult wall.

Another thing is TeX - the glorious creation of the great master. If you want to become
With this technician, you read the standard guide from cover to cover.
described in TeXbook. I decided to become a seasoned specialist - again you study
from cover to cover the book "TeX The Program", in which all 20,000 lines
TeX programs (TeX is written in Pascal, fuck me!) are described
simple understandable human language is a literary work
a detailed description of the program from a bird's flight right up to
the smallest details. Everything. Two books. Alpha and Omega. The technology is described
from the bottom to the top and from all sides - no one will say more. To in
to fully experience the methodology, I highly recommend taking a look at Knut's three major literary programs, “TeX The Program” [http://db.tt/X8debml],
"METAFONT The Program" and "MMIXware".

Literary programming is not just another approach to
documentation. It is much deeper - this is the path connecting hearts
program and programmer. And this path will remain unclimbed, until
until literary programming is applied on

Source: https://habr.com/ru/post/105371/

All Articles