
Knuth: Computer Programming as an Art (1974) - theideasmith
http://www.paulgraham.com/knuth.html
======
henrik_w
On the subject of art and programming, I really like how Fred Brooks described
it in "The Mythical Man-Month":

 _The delight of working in such a tractable medium. The programmer, like the
poet, works only slightly removed from pure thought-stuff. He builds his
castles in the air, from air, creating by exertion of imagination. Yet the
program construct, unlike the poet’s words, is real in the sense that it moves
and works, producing visible outputs separate from the construct itself._

I wrote more on this subject in "Why I Love Coding"
[http://henrikwarne.com/2012/06/02/why-i-love-
coding/](http://henrikwarne.com/2012/06/02/why-i-love-coding/)

~~~
ricksplat
Bertrand Russell also had this to say: _Mathematics, rightly viewed, possesses
not only truth, but supreme beauty—a beauty cold and austere, like that of
sculpture, without appeal to any part of our weaker nature, without the
gorgeous trappings of painting or music, yet sublimely pure, and capable of a
stern perfection such as only the greatest art can show._

I think this could equally be said for computer programming, except it is
given life. We can see theory animated.

------
jim-greer
Programming is much more of a craft than it is either an art or a science.
Good craftsmanship combines beauty with utility, as does good coding.

Programmers work with abstractions, rather than with wood or clay. And their
craft is as cerebral and intellectually demanding as an art or a science. But
it's still a craft.

~~~
randomsearch
I agree, craft is much more appropriate.

I think this is a confusing essay, because in everyday speech "art" is
employed to mean something very different from "an art" and we get lost in
semantics. The continued references to obsolete definitions confuse things
further.

In practice, the phrase "an art" is usually used in the same way as "an
artform", as it is not meant to be taken literally; a commentator may say
"there's a real art to mastering the offside trap" in football, but he does
not mean that the defender should be put in a glass case in a contemporary art
gallery.

The whole art/science classification of programming appears to me to be people
defending their philosophy or encampment. If you're working in formal methods,
you're likely to say "it's about the science", but if you're hacking the last
cycle out of a console processor in the games industry you might say "wow,
that was really clever, it's really an art this isn't it?"

I'd say both of these views are daft. "Science" is usually synonymous with
Physics/Chemistry/Biology, which are inescapably different from programming or
Computer Science. Similarly, fine arts is not isomorphic to programming.

What we usually do is much more like a craft. Sure, it has elements of
engineering and maths, and in CS research we borrow some of the scientific
method some of the time, but you could probably say the same about any craft,
e.g. making jewellery, pottery, etc.

All crafts can strive for both beauty and utility, and can borrow from
scientific methods and engineering when appropriate, but "pure" science or
"pure" art they ain't. There's no ground truth in craft, and there's a strong
degree of utility, which precludes it from being science or art respectively.

I've heard this discussion dozens of times. Always the mathematicians want CS
to be a science, and the hackers want it to be an art or maybe engineering,
but I think the argument is counter-productive. Programming is quite unique,
but if you really want a relative description, it's kinda like a craft that
uses certain maths and engineering in places.

I think dropping "science" from "Computer Science" would help immeasurably.
Simply renaming a university department to "Computing" might stop students and
staff worrying what they are.

~~~
TheOtherHobbes
I agree, but I'll go further than you - I don't think this essay is confusing
at all. It's simply nonsense - the kind of thing someone clever writes when
they're discussing a subject completely outside their area of competence.

CS can be a craft. It's not one of the arts, not even if it's beautifully put
together, because the arts are not primarily about technique - they're about
capturing and distilling human experiences using allusions and associations to
(re)create those experiences. Fluent technique is a useful tool that help with
that, but it's not the point.

(Modern art is a bit more limited than that, but that's more or less what art
meant for most of Western history.)

The experiences created by the most timeless art are focused, but also
ambiguous and complicated. You can get lost in them, and although there's
often a clear theme, you can't define the rest of what's happening with
absolute final precision.

That's almost exactly the opposite of what good code does. Which is why
"That's a clever, clean solution" is an experience that exists in the
craftsman's world, and is either peripheral or completely absent from an
artist's view.

>I think dropping "science" from "Computer Science" would help immeasurably.

At my university the joke was always that it should be called "Computer
Studies." Only a nugget of algorithmic research is genuinely scientific, and
that lives in a tiny corner of the rest of the Pure Math. There could be a lot
more formal provability, but going down that route would put a lot of
programmers out of work, because the level of difficulty is much higher than
that needed to crank out some JavaScript.

What's left is usually neither rigorous nor beautiful.

~~~
krmboya
> I agree, but I'll go further than you - I don't think this essay is
> confusing at all. It's simply nonsense - the kind of thing someone clever
> writes when they're discussing a subject completely outside their area of
> competence.

I'm not sure what you're implying here, but Knuth does know what art is, as he
almost majored in Music. See this for some recent work:
[https://www.youtube.com/watch?v=e_1a6bHGQGo](https://www.youtube.com/watch?v=e_1a6bHGQGo)

~~~
randomsearch
> I'm not sure what you're implying here, but Knuth does know what art is, as
> he almost majored in Music.

What are you implying? That studying some Music makes you an artist?

------
proc0
Great read. Indeed programming is not a 'gentle art', I would say it's a
'brutal art'.

There was an article outlining a continuum between art and science, where
engineering was somewhere in the middle. Art is the least rigorous of them,
while science has the most rigor.

Being a science enthusiast, reading on quantum physics, evolutionary biology,
etc., I've learned more/less how scientists think. It has a lot to do with
coming up with not only good explanations, but explanations that are extremely
hard to vary. Explanations that risk falling apart if you try to change any
aspect of it. This together with a mountain of evidence supporting said
explanation, makes for good science.

Art on the other hand, is arguably vague by definition. Art that is doesn't
leave room for interpretation is often bland. Art also has a huge human
component, whereas science tries to do away with it.

In my opinion, programming can easily be both an art and a science. There's no
need to constrain it to either one. On one hand, you have the mathematical
theory of information, describing a hard-to-vary explanation that is backed up
with great math(s). On the other, you have an infinite set of tools from which
you can craft whatever your imagination is capable of coming up with.
Programming, having its foundations in mathematics, leverages its infinite
potential, and with it the possibility of creating both works of art, and
scientific facts. It is this universe of possibility that takes only the
toughest of minds to venture and explore.

------
kazinator
Art can occur when the same person is both the source of the requirements for
the program, and the implementor of the program. Much of the art is in the
coming up with the specification: that is the concept in the art. The concept
can be skillfully rendered into code. Concept + skillful rendering = art.

~~~
crimsonalucard
What about algorithm problems for with the most efficient Big-O solution is
known? How can you "skillfully" render code when there is only one best
possible way to do it?

I would argue that in those cases, programming is not an art because the
arriving at the solution is very mechanical and there is literally zero room
for creativity. Thus imo this answer isn't broad enough to fully define "Art"

~~~
Someone
Change the constant.

Change the x that the big O is about, for example by using vector
instructions.

Implement a theoretically less efficient algorithm that is faster (examples:
switch to a O(n^2) sort for small data set, or to a linear search for smallish
arrays)

~~~
kazinator
Use data with a smaller size N, and do something more interesting with it.

------
scandox
" The moral of this story, it seems to me, is that we should make use of the
idea of limited resources in our own education. We can all benefit by doing
occasional "toy" programs, when artificial restrictions are set up, so that we
are forced to push our abilities to the limit. We shouldn't live in the lap of
luxury all the time, since that tends to make us lethargic."

I love the way Knuth expresses himself.

------
xixixao
I take for Science the natural and social sciences (see Wikipedia article on
Science). In other words, Physics and all its sub divisions. In this respect,
programming is not a science. CS is mostly a sub division of Math (also, not a
science). Programming is a mix of engineering (that is finding an optimal
solution given a set of known tools to a non-universal problem) and art -
anything that allows for creativity in the forming of a finalized product.
Most engineering disciplines have an aspect of art in them, but programming is
perhaps the most artful thanks to the incredibly wide range of close-to-
optimal solutions. But programming is also one more thing: a social process,
the process of organising people and their work (which is neither science, nor
math, nor art).

------
twobuy
I'm only 3 months into coding but I've already heard about Knuth's books. This
is a great intro to his writing, I'd like to read more.

------
zekevermillion
Why is it that "it's more art than science" gets so much use, whereas "it's
more science than art" is never used? We use the former to explain why a given
process is not deterministic -- for example, appraising artwork, drafting a
business plan. Why is it never necessary to explain that a process is
deterministic?

~~~
ilzmastr
Because deterministic processes are easy to predict and therefore boring? :)

------
workitout
Love this part, "In fact, when I first picked up a dictionary in order to
study the words "art" and "science," I happened to glance at the editor's
preface, which began by saying, "The making of a dictionary is both a science
and an art.""

~~~
myth_buster
Also

    
    
      "The science without the art is likely to be ineffective; 
      the art without the science is certain to be inaccurate."

------
ilzmastr
Paul Cronin: Are you an artist?

Herzog: Never. All I've ever wanted to be is a foot soldier of cinema.

------
crimsonalucard
Knuth has a very abstract and fuzzy definition of "Art." Personally I feel
"art" possesses a more concrete definition.

When the most efficient solution to a problem isn't known we rely on art and
design to fill the void. When the path to the most efficient solution of a
problem is known we rely on "science" or technical procedures to deduce the
best possible answer.

For many problems in programming we know the best possible solution. However,
for most of the apps we build to solve problems in the name of
entrepreneurship or business, no efficient solution is known. In fact, in
these situations, the problem isn't even clearly defined. When we don't know
the "best" solution we use intuition and creativity to come up with a solution
that we only intuitively know to be somewhat efficient.

Programming isn't the only area where this occurs. All of engineering relies
on art and design to solve problems where the most efficient solution isn't
known.

For example, what is the shortest distance between point A and point B? The
answer is a straight line. There is no design or art as part of this solution
because a straight line is mathematically proven to be the most efficient
possible answer. The answer, in essence, was calculated and thus no "art" or
design was involved. Utilizing art in this case would be as pointless as
drawing an artsy squiggly line between point a and point b.

Now, allow me to modify the problem to make it a little more complex. Instead
of calculating the shortest path between two points, how do I find the most
efficient way to transport a person from point A to point B?

The most efficient answer is mind boggling complex, you have to account for
the personalities and definitions of "efficient" for every possible person you
can transport, energy, speed, obstacles etc etc. There probably is a most
efficient solution but know one knows it.

Here, where it is very hard for us to deduce the most efficient solution we
rely on Art.

With "art" we can come up with multitudes of solutions to the problem on how
to transport a person from point a to point b. Cars (thousands of different
models), flying vehicles (thousands of different innovations as well) are two
possible examples out of many forms of locomotion. The reason why there are so
many models/solutions is because we can never concretely determine which
"solution" was the most efficient.

This is what we mean when we use the word "Art" in the context of "The Art of
Programming" or "The Art of combat." We are essentially describing a problem
domain space that is so complex our pathetic human minds our reduced to a sort
of aimless wandering (aka creativity) to come up with a solution that isn't
even the most efficient one.

I use the word aimless because we iterate over our solutions endlessly in an
endless quest to arrive at the best solution. The "quest" is essentially
endless because our "path" is aimless. We will never ever create the most
efficient OS or iphone app of all time because we don't even know what the
hell that even means. Instead we are cursed to iterate endlessly over our
programs creating version after version for all eternity.

The majority of problems in the real world rely on a bit of "art" to arrive at
a solution. In fact, most of the problems where an "efficient" solution is
known are just theoretical conjectures that only exist in an idealized virtual
universe.

I see this as a good thing. Art is fun.

------
peter303
I've always felt writing working software was like creating art. I am pleased
when something works and does something interesting after a long effort.

------
rdtsc
> Meanwhile we have actually succeeded in making our discipline a science, and
> in a remarkably simple way: merely by deciding to call it "computer
> science."

Well not only that but we actually stuffed two misnomers in there. It is not
really a science, and it is not really about computers. Chip design, graphics,
storage, input devices is more about computers as such.

~~~
Munksgaard
Peter Naur (who unfortunately passed away recently) suggested the term
"datalogy", to indicate that computer science doesn't necessarily have
anything to do with computers, but instead is about the treatment of data[0].
The term "datalogi" is actually used in Denmark instead of "computer science".

0:
[https://en.wikipedia.org/wiki/Computer_science#Name_of_the_f...](https://en.wikipedia.org/wiki/Computer_science#Name_of_the_field)

~~~
randomsearch
How does this fit with, say, designing an ergonomic phone interface? Or
constructing quantum computers using optics? I think this is another example
of one person calling Computer Science what they would like it to be, because
of their background.

~~~
majewsky
Designing an ergonomic phone interface can be grouped under communication
design, thus art. Constructing a quantum computer using optics clearly falls
into the physics department, at least until physics spins off an engineering
department for quantum stuff, like it spun off mechanics and electronics in
earlier centuries.

I consider the term "computer science" historically motivated and
anachronistic. Similar to how old people would stereotypically describe their
child's job as "something with computers", we muddled subtopics of various
sciences together just because they're doing "something with computers".

With computing technology and methodology now permeating nearly all areas of
science, art, and engineering, maybe it's time to tear down the computer
science departments and reintegrate their pieces back into the appropriate
departments.

Or maybe we shouldn't, for we would lose the extremely diverse curriculum that
a CS degree includes.

------
laacz
Practically anything can be performed at the level that it would be considered
an art.

------
bradhe
I start having a real tough time with this "code as art" argument when "code"
becomes little more than gluing some Rails bullshit together.

~~~
majewsky
This fits in well with the "code as craft" argument presented in the comments
here. Most craftsmen need to make a living by producing rather boring,
functional pieces in a large volume, while occasionally taking the time to
manufacture an intricate masterpiece.

In this sense, your run-of-the-mill Rails app is the IKEA table of coding.

------
scandox
"A knowledge of the Science of Number is of minor importance; skill in the Art
of Reckoning is absolutely indispensible."

I laughed out loud at that.

------
ajdlinux
I believe the title should be "Knuth: Computer Programming as an Art"...

~~~
dang
Yes. We changed the title from "Paul Graham: Programming as Art".

Submitters: please use the original title except when it is misleading or
linkbait. This is in the HN guidelines:
[https://news.ycombinator.com/newsguidelines.html](https://news.ycombinator.com/newsguidelines.html)

------
locacorten
I lived the day to see YC giving credit to PG for an article written by Knuth.

What's next? Symphony No. 9 by Paul Graham? Theory of Relativity by Paul
Graham? The Bible? :-)

~~~
tim333
Title now changed from "Paul Graham: Programming as Art" to Knuth:

~~~
ezequiel-garzon
OK, but why does PG host this? It's freely available:
[http://dl.acm.org/citation.cfm?id=361612](http://dl.acm.org/citation.cfm?id=361612)

~~~
gjm11
That one is a scanned PDF; its contents don't appear to be indexed by, e.g.,
Google; its availability is dependent on the continued goodwill of the ACM.

Paul Graham's copy is plain HTML, sitting on the open web where anyone can see
it and index it, and while for the rest of us its availability is dependent on
PG's continued goodwill presumably _he_ likes being able to rely on it staying
there as long as he wants unless he's explicitly forced to take it down
somehow.

~~~
jlarocco
What a bunch of lame BS excuses.

Searching for "Computer Programming as an Art" the PDF comes up as the second
link (below PG's rip off). Not that it's even relevant because it's given as a
direct link.

A scanned PDF is a closer reproduction to the original presentation, and
easier to save for later to read.

I trust the ACM's "goodwill" to continue hosting it more than I trust it to
remain on PG's website.

~~~
gjm11
> the PDF comes up as the second link

Sure, if you search for _its title_. But if you search for text within it,
you'll find it doesn't come up at all.

> I trust the ACM's "goodwill" [...]

Sure. My suggestion is that _Paul Graham_ trusts his own goodwill more than
the ACM's and that that's one reason why he's put a copy on his website.

------
camperman
"How did they develop their skill? The best film makers through the years
usually seem to have learned their art in comparatively primitive
circumstances, often in other countries with a limited movie industry. And in
recent years the most important things we have been learning about programming
seem to have originated with people who did not have access to very large
computers. The moral of this story, it seems to me, is that we should make use
of the idea of limited resources in our own education. We can all benefit by
doing occasional "toy" programs, when artificial restrictions are set up, so
that we are forced to push our abilities to the limit. We shouldn't live in
the lap of luxury all the time, since that tends to make us lethargic. The art
of tackling miniproblems with all our energy will sharpen our talents for the
real problems, and the experience will help us to get more pleasure from our
accomplishments on less restricted equipment."

So true. Robert Rodriguez filmed El Mariachi with almost no resources. It's
why the demoscene produced - and still produces - such amazing creations
within its self-imposed strict limits. It's one of the reasons why the
Raspberry Pi is so popular and why you see the most beautiful ARM assembly on
the Gameboy.

And conversely I think it's why Web development is collapsing under the weight
of too many shiny things. It's lethargic and living in the lap of luxury. I
watched a video the other day of AirBNB talking about the evolution of its Web
site. The 2008 version was fine: Rails, a database and dynamic page output.
The 2015 version was insane: Rails, React, Node, all sorts of dependencies,
some stuff I'd never heard of but that the speaker assured was good, complex
mobile optimization when you could instead, you know, just write lean and mean
mobile-friendly HTML.

Limit yourself instead and see what happens - the results might just be
awesome.

~~~
picardo
I think you're mixing up the intended use of the "toy project," i.e. skill
development, with the complexity of a real world project with a growing number
of use cases, including a proliferating number of mobile devices and features
–– just something to keep in mind.

~~~
camperman
I was stirring :) I think that it's not coincidental that Web development
frameworks are collapsing under their own weight and programmers are going mad
because there's just too many shiny things.

------
dschiptsov
If we define an art as strive to reach an aesthetic global optimum, by
balancing form and meaning (syntax and semantics, if you wish, design and
implementation) with attention to every single detail, then [some] programming
is an art without a slightest doubt.

~~~
crimsonalucard
Aesthetic global optimum can never be reached as it changes with time and
differs among people. We are cursed to eternally iterate over our programs in
attempt to reach this lofty goal.

Let me know if you've seen any program that can be described as aesthetically
optimal.

~~~
dschiptsov
> Aesthetic global optimum can never be reached

Do you honestly think that writers, painters or composers doesn't know it, or
it stopped them from striving?

Millions of little pieces - Data modules from GHC, especially logic, lists,
big chunks from Erlang stdlib, lib9, libbio, libutf from Inferno, parts of
various Lisps, tons of code from carefully written books (PoFAD, PAIP/ALMA,
OnLisp, etc) well-crafted projects like nginx, or even something like this:

[http://karma-engineering.com/lab/wiki/Bootstrapping8](http://karma-
engineering.com/lab/wiki/Bootstrapping8)

[shit removed]

~~~
crimsonalucard
Dude, I wasn't even arguing with you. It's a true statement.

My response was not meant to be in opposition to yours, it's just a remark.
There was no need to say that. Don't start shit. Your comment needs to be
flagged.

~~~
dschiptsov
OK. Sorry. Flag it if you wish. It seems that I should stop reading Russian
political forums.

------
lionize
Paul Graham is no Knuth

------
pjbrunet
"According to most dictionaries "science" means knowledge that has been
logically arranged and systematized in the form of general "laws.""

Ahh yes, the logical arrangement.

    
    
      Programming Law #1: Thou shalt tab to indent. 
      Programming Law #2: Nested loops shall indent deeper to the right.
    

How about the six laws of depth in art?

    
    
      1. Perspective - 2-point, 3-point...
      2. Lower on canvas is closer, higher is further away
      3. Atmosphere - clearer is closer, blur is further
      3b. Color intensity - higher saturation is closer
      4. Chiaroscuro - the next alternation is further (combination of #2 and #5)
      5. Overlap - this behind that
      6. Scale - bigger is closer
    

Art has plenty of laws, some very complex, but you won't find them in Google.
You have to find the artists' artist and mix her color 5000 times, like roll-
on-your-head Shaolin Temple skull-hardening. Return to the 36th Chamber and
draw with charcoal attached to the end of a long stick of bamboo, then ring
the bell, for another style has died.

~~~
_petronius
> You have to find the artists' artist and mix her color 5000 times, like
> roll-on-your-head Shaolin Temple skull-hardening. Return to the 36th Chamber
> and draw with charcoal attached to the end of a long stick of bamboo, then
> ring the bell, for another style has died.

Or, you know, go to art school.

~~~
_petronius
Why the downvote aggro for a tounge-in-cheek quip?

~~~
pjbrunet
It wasn't me. I think art school should help, but you never know what you're
going to get there. A lot of info slips through the cracks.

